打包管理

This commit is contained in:
梁琦涛
2021-09-10 14:41:58 +08:00
parent 6fab748c60
commit bb81b4b7af
12 changed files with 200 additions and 93 deletions
@@ -1,9 +1,11 @@
package com.jero.pack.controller;
import java.util.Arrays;
import java.util.Objects;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -23,12 +25,12 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* @Description: 打包关联
* @Description: 打包企业管理
* @Author: jeecg-boot
* @Date: 2021-09-07
* @Version: V1.0
*/
@Api(tags="打包关联")
@Api(tags="打包企业管理")
@RestController
@RequestMapping("/pack/payPackCompany")
@Slf4j
@@ -45,8 +47,8 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
* @param req
* @return
*/
@AutoLog(value = "打包关联-分页列表查询")
@ApiOperation(value="打包关联-分页列表查询", notes="打包关联-分页列表查询")
@AutoLog(value = "打包企业管理-分页列表查询")
@ApiOperation(value="打包企业管理-分页列表查询", notes="打包企业管理-分页列表查询")
@GetMapping(value = "/list")
public Result<?> queryPageList(PayPackCompany payPackCompany,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@@ -64,14 +66,27 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
* @param payPackCompany
* @return
*/
@AutoLog(value = "打包关联-添加")
@ApiOperation(value="打包关联-添加", notes="打包关联-添加")
@AutoLog(value = "打包企业管理-添加")
@ApiOperation(value="打包企业管理-添加", notes="打包企业管理-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody PayPackCompany payPackCompany) {
StringBuilder msg = ValidUtil.validateAll(payPackCompany);
if(!StringUtils.isBlank(msg)){
return Result.error(msg.toString());
}
try {
LambdaQueryWrapper<PayPackCompany> query = new LambdaQueryWrapper<>();
query.eq(PayPackCompany::getCompanyId,payPackCompany.getCompanyId());
query.eq(PayPackCompany::getPackYear,payPackCompany.getPackYear());
PayPackCompany payPackCompanyNew = payPackCompanyService.getOne(query);
if(!Objects.isNull(payPackCompanyNew)){
return Result.error("当前年份下已存在打包企业!");
}
}catch (Exception e){
log.error("",e);
return Result.error("当前年份下已存在打包企业!");
}
payPackCompanyService.save(payPackCompany);
return Result.OK("添加成功!");
}
@@ -82,14 +97,26 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
* @param payPackCompany
* @return
*/
@AutoLog(value = "打包关联-编辑")
@ApiOperation(value="打包关联-编辑", notes="打包关联-编辑")
@AutoLog(value = "打包企业管理-编辑")
@ApiOperation(value="打包企业管理-编辑", notes="打包企业管理-编辑")
@PostMapping(value = "/edit")
public Result<?> edit(@RequestBody PayPackCompany payPackCompany) {
StringBuilder msg = ValidUtil.validateAll(payPackCompany);
if(!StringUtils.isBlank(msg)){
return Result.error(msg.toString());
}
try {
LambdaQueryWrapper<PayPackCompany> query = new LambdaQueryWrapper<>();
query.eq(PayPackCompany::getCompanyId,payPackCompany.getCompanyId());
query.eq(PayPackCompany::getPackYear,payPackCompany.getPackYear());
PayPackCompany payPackCompanyNew = payPackCompanyService.getOne(query);
if(!Objects.isNull(payPackCompanyNew) && !Objects.equals(payPackCompany.getId(),payPackCompanyNew.getId())){
return Result.error("当前年份下已存在打包企业!");
}
}catch (Exception e){
log.error("",e);
return Result.error("当前年份下已存在打包企业!");
}
payPackCompanyService.updateById(payPackCompany);
return Result.OK("编辑成功!");
}
@@ -117,8 +144,8 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
* @param ids
* @return
*/
@AutoLog(value = "打包关联-批量删除")
@ApiOperation(value="打包关联-批量删除", notes="打包关联-批量删除")
@AutoLog(value = "打包企业管理-批量删除")
@ApiOperation(value="打包企业管理-批量删除", notes="打包企业管理-批量删除")
@GetMapping(value = "/deleteBatch")
public Result<?> deleteBatch(@RequestParam(name="ids") String ids) {
if(StringUtils.isBlank(ids)){
@@ -140,8 +167,8 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
* @param id
* @return
*/
@AutoLog(value = "打包关联-通过id查询")
@ApiOperation(value="打包关联-通过id查询", notes="打包关联-通过id查询")
@AutoLog(value = "打包企业管理-通过id查询")
@ApiOperation(value="打包企业管理-通过id查询", notes="打包企业管理-通过id查询")
@GetMapping(value = "/queryById")
public Result<?> queryById(@RequestParam(name="id") String id) {
if(StringUtils.isBlank(id)){
@@ -162,7 +189,7 @@ public class PayPackCompanyController extends JeroController<PayPackCompany, IPa
*/
@GetMapping(value = "/exportXls")
public ModelAndView exportXls(HttpServletRequest request, PayPackCompany payPackCompany) {
return super.exportXls(request, payPackCompany, PayPackCompany.class, "pay_pack_company");
return super.exportXls(request, payPackCompany, PayPackCompany.class, "打包企业管理");
}
/**