master
parent
1259d5e81f
commit
a063e4ac01
@ -0,0 +1,68 @@
|
||||
package com.gszc.controller;
|
||||
|
||||
import com.gszc.build.Result;
|
||||
import com.gszc.build.ResultBuilder;
|
||||
import com.gszc.entity.InvoiceCategory;
|
||||
import com.gszc.service.impl.InvoiceCategoryServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
@Api(value = "工商注册 API", tags = {"开票类目 api"})
|
||||
@RestController
|
||||
@RequestMapping("/invoiceCategory")
|
||||
public class InvoiceCategoryController {
|
||||
|
||||
@Autowired
|
||||
InvoiceCategoryServiceImpl invoiceCategoryService;
|
||||
|
||||
@PostMapping("/addInvoiceCategory")
|
||||
@ApiOperation(value = "增加invoiceCategory", notes = "增加invoiceCategory")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
|
||||
})
|
||||
@ResponseBody
|
||||
public Result addInvoiceCategory(@ModelAttribute @Valid InvoiceCategory invoiceCategory) {
|
||||
invoiceCategoryService.addInvoiceCategory(invoiceCategory);
|
||||
return ResultBuilder.success().build();
|
||||
}
|
||||
|
||||
@PostMapping("/deleteInvoiceCategory")
|
||||
@ApiOperation(value = "删除invoiceCategory", notes = "删除invoiceCategory")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
|
||||
})
|
||||
@ResponseBody
|
||||
public Result deleteInvoiceCategory(@ModelAttribute @Valid InvoiceCategory invoiceCategory) {
|
||||
invoiceCategoryService.deleteInvoiceCategory(invoiceCategory);
|
||||
return ResultBuilder.success().build();
|
||||
}
|
||||
|
||||
@PostMapping("/updateInvoiceCategory")
|
||||
@ApiOperation(value = "更新invoiceCategory", notes = "更新invoiceCategory")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
|
||||
})
|
||||
@ResponseBody
|
||||
public Result updateInvoiceCategory(@ModelAttribute @Valid InvoiceCategory invoiceCategory) {
|
||||
invoiceCategoryService.updateInvoiceCategory(invoiceCategory);
|
||||
return ResultBuilder.success().build();
|
||||
}
|
||||
|
||||
@PostMapping("/queryInvoiceCategory")
|
||||
@ApiOperation(value = "查看invoiceCategory", notes = "查看invoiceCategory")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "token", value = "token", required = true, dataType = "String", paramType = "header"),
|
||||
})
|
||||
@ResponseBody
|
||||
public Result queryInvoiceCategory(Integer pageNum,Integer pageSize) {
|
||||
List<InvoiceCategory> invoiceCategorys = invoiceCategoryService.queryInvoiceCategory(pageNum, pageSize);
|
||||
return ResultBuilder.withPayload(invoiceCategorys).build();
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.gszc.service;
|
||||
|
||||
import com.gszc.entity.InvoiceCategory;
|
||||
import com.baomidou.mybatisplus.service.IService;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 开票类目表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author ky
|
||||
* @since 2020-05-26
|
||||
*/
|
||||
public interface IInvoiceCategoryService extends IService<InvoiceCategory> {
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.gszc.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
||||
import com.baomidou.mybatisplus.plugins.Page;
|
||||
import com.gszc.entity.InvoiceCategory;
|
||||
import com.gszc.entity.InvoiceCategory;
|
||||
import com.gszc.mapper.InvoiceCategoryMapper;
|
||||
import com.gszc.mapper.InvoiceCategoryMapper;
|
||||
import com.gszc.service.IInvoiceCategoryService;
|
||||
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 开票类目表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author ky
|
||||
* @since 2020-05-26
|
||||
*/
|
||||
@Service
|
||||
public class InvoiceCategoryServiceImpl extends ServiceImpl<InvoiceCategoryMapper, InvoiceCategory> implements IInvoiceCategoryService {
|
||||
@Autowired
|
||||
InvoiceCategoryMapper invoiceCategoryMapper;
|
||||
|
||||
public void addInvoiceCategory(InvoiceCategory invoiceCategory){
|
||||
List<InvoiceCategory> result = invoiceCategoryMapper.selectList(new EntityWrapper<InvoiceCategory>().eq("1", "1").orderBy("id", false));
|
||||
Integer id = result.get(0).getId();
|
||||
invoiceCategory.setId(id+1);
|
||||
invoiceCategoryMapper.insert(invoiceCategory);
|
||||
}
|
||||
|
||||
public void deleteInvoiceCategory(InvoiceCategory invoiceCategory){
|
||||
invoiceCategoryMapper.deleteById(invoiceCategory);
|
||||
}
|
||||
|
||||
public void updateInvoiceCategory(InvoiceCategory invoiceCategory){
|
||||
invoiceCategoryMapper.updateById(invoiceCategory);
|
||||
}
|
||||
|
||||
public List<InvoiceCategory> queryInvoiceCategory(Integer pageNum, Integer pageSize){
|
||||
|
||||
List<InvoiceCategory> result = invoiceCategoryMapper.selectPage(new Page<>((pageNum - 1) * pageSize, pageSize), new EntityWrapper<InvoiceCategory>().eq("1", "1").orderBy("id", true));
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue