修改关键零部件型号库

This commit is contained in:
梁琦涛
2024-09-27 15:15:38 +08:00
parent 58c0e4f4aa
commit 59949d4d6a
6 changed files with 205 additions and 63 deletions
@@ -6,35 +6,31 @@ import com.jero.common.api.vo.Result;
import com.jero.common.api.vo.ResultCommon;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.aspect.annotation.Translation;
import com.jero.modules.laws.part.entity.LawsPartRelevance;
import com.jero.modules.laws.part.service.ILawsPartRelevanceService;
import com.jero.modules.laws.part.entity.LawsPartType;
import com.jero.modules.laws.part.service.ILawsPartTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Map;
@Api(tags = "业务支持-关键零部件绑定关系管理")
@Api(tags = "业务支持-关键零部件型号库")
@RestController
@RequestMapping("/laws/lawsPartType")
@Slf4j
public class LawsPartTypeController {
@Resource
private ILawsPartRelevanceService lawsPartRelevanceService;
private ILawsPartTypeService lawsPartTypeService;
/**
* 分页列表查询
@@ -44,32 +40,32 @@ public class LawsPartTypeController {
* @param pageSize
* @return
*/
@AutoLog(value = "业务支持-关键零部件绑定关系管理-分页列表查询")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-分页列表查询", notes = "业务支持-关键零部件绑定关系管理-分页列表查询")
@AutoLog(value = "业务支持-关键零部件型号库-分页列表查询")
@ApiOperation(value = "业务支持-关键零部件型号库-分页列表查询", notes = "业务支持-关键零部件型号库-分页列表查询")
@GetMapping(value = "/page")
@ApiOperationSupport(order = 1)
@RequiresPermissions("keyPartBindingManage:search")
public Result<IPage<LawsPartRelevance>> queryPageList(LawsPartRelevance lawsPartRelevance,
public Result<IPage<LawsPartType>> queryPageList(LawsPartType lawsPartType,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
IPage<LawsPartRelevance> pageList = lawsPartRelevanceService.queryPage(lawsPartRelevance, pageNo, pageSize, req);
IPage<LawsPartType> pageList = lawsPartTypeService.queryPage(lawsPartType, pageNo, pageSize, req);
return Result.OK(pageList);
}
/**
* 详情
*
* @param lawsPartRelevance
* @param lawsPartType
* @return
*/
@AutoLog(value = "业务支持-关键零部件绑定关系管理-详情")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-详情", notes = "业务支持-关键零部件绑定关系管理-详情")
@AutoLog(value = "业务支持-关键零部件型号库-详情")
@ApiOperation(value = "业务支持-关键零部件型号库-详情", notes = "业务支持-关键零部件型号库-详情")
@GetMapping(value = "/queryById")
@ApiOperationSupport(order = 2)
@Translation
public Result<LawsPartRelevance> queryById(LawsPartRelevance lawsPartRelevance) {
LawsPartRelevance result = lawsPartRelevanceService.queryById(lawsPartRelevance.getId());
public Result<LawsPartType> queryById(LawsPartType lawsPartType) {
LawsPartType result = lawsPartTypeService.queryById(lawsPartType.getId());
return Result.OK(result);
}
@@ -79,8 +75,8 @@ public class LawsPartTypeController {
* @param map
* @return
*/
@AutoLog(value = "业务支持-关键零部件绑定关系管理-删除")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-删除", notes = "业务支持-关键零部件绑定关系管理-删除")
@AutoLog(value = "业务支持-关键零部件型号库-删除")
@ApiOperation(value = "业务支持-关键零部件型号库-删除", notes = "业务支持-关键零部件型号库-删除")
@ApiOperationSupport(order = 4)
@PostMapping(value = "/delete")
@RequiresPermissions("keyPartBindingManage:delete")
@@ -88,7 +84,7 @@ public class LawsPartTypeController {
if (!map.containsKey("id") || StringUtils.isEmpty(map.get("id"))) {
return Result.error(ResultCommon.SELECT_DATA);
}
this.lawsPartRelevanceService.deleteById(map.get("id"));
this.lawsPartTypeService.deleteById(map.get("id"));
return Result.OK(ResultCommon.OK);
}
@@ -98,8 +94,8 @@ public class LawsPartTypeController {
* @param map
* @return
*/
@AutoLog(value = "业务支持-关键零部件绑定关系管理-批量删除")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-批量删除", notes = "业务支持-关键零部件绑定关系管理-批量删除")
@AutoLog(value = "业务支持-关键零部件型号库-批量删除")
@ApiOperation(value = "业务支持-关键零部件型号库-批量删除", notes = "业务支持-关键零部件型号库-批量删除")
@ApiOperationSupport(order = 4)
@PostMapping(value = "/deleteBatch")
@RequiresPermissions("keyPartBindingManage:batchDel")
@@ -107,70 +103,55 @@ public class LawsPartTypeController {
if (!map.containsKey("ids") || StringUtils.isEmpty(map.get("ids"))) {
return Result.error(ResultCommon.SELECT_DATA);
}
this.lawsPartRelevanceService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
this.lawsPartTypeService.deleteByIds(Arrays.asList(map.get("ids").split(",")));
return Result.OK(ResultCommon.OK);
}
/**
* 新增
*
* @param lawsPartRelevance
* @param lawsPartType
* @return
*/
@AutoLog(value = "业务支持-关键零部件绑定关系管理-新增")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-新增", notes = "业务支持-关键零部件绑定关系管理-新增")
@AutoLog(value = "业务支持-关键零部件型号库-新增")
@ApiOperation(value = "业务支持-关键零部件型号库-新增", notes = "业务支持-关键零部件型号库-新增")
@ApiOperationSupport(order = 5)
@PostMapping(value = "/add")
@RequiresPermissions("keyPartBindingManage:add")
public Result<T> add(@Validated @RequestBody LawsPartRelevance lawsPartRelevance) {
lawsPartRelevanceService.add(lawsPartRelevance);
public Result<T> add(@Validated @RequestBody LawsPartType lawsPartType) {
lawsPartTypeService.add(lawsPartType);
return Result.OK(ResultCommon.OK);
}
/**
* 编辑
*
* @param lawsPartRelevance
* @param lawsPartType
* @return
*/
@AutoLog(value = "业务支持-关键零部件绑定关系管理-编辑")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-编辑", notes = "业务支持-关键零部件绑定关系管理-编辑")
@AutoLog(value = "业务支持-关键零部件型号库-编辑")
@ApiOperation(value = "业务支持-关键零部件型号库-编辑", notes = "业务支持-关键零部件型号库-编辑")
@ApiOperationSupport(order = 6)
@PostMapping(value = "/edit")
@RequiresPermissions("keyPartBindingManage:import")
public Result<T> edit(@Validated @RequestBody LawsPartRelevance lawsPartRelevance) {
this.lawsPartRelevanceService.edit(lawsPartRelevance);
public Result<T> edit(@Validated @RequestBody LawsPartType lawsPartType) {
this.lawsPartTypeService.edit(lawsPartType);
return Result.OK(ResultCommon.OK);
}
/**
* 作废
*
* @param lawsPartType
* @return
*/
@AutoLog(value = "业务支持-关键零部件型号库-作废")
@ApiOperation(value = "业务支持-关键零部件型号库-作废", notes = "业务支持-关键零部件型号库-作废")
@ApiOperationSupport(order = 6)
@PostMapping(value = "/cancellation")
@RequiresPermissions("keyPartBindingManage:import")
public Result<T> cancellation(@Validated @RequestBody LawsPartType lawsPartType) {
this.lawsPartTypeService.cancellation(lawsPartType);
return Result.OK(ResultCommon.OK);
}
/**
* 导入
*
* @param file
* @return
*/
@AutoLog(value = "业务支持-关键零部件绑定关系管理-导入")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-导入", notes = "业务支持-关键零部件绑定关系管理-导入")
@ApiOperationSupport(order = 7)
@PostMapping(value = "/importExcel")
@RequiresPermissions("keyPartBindingManage:import")
public Result<?> importExcel(@RequestParam("file") @ApiParam("文件") MultipartFile file) {
return lawsPartRelevanceService.importExcel(file);
}
/**
* 下载模版
*
* @param
* @return
*/
@AutoLog(value = "业务支持-关键零部件绑定关系管理-下载模版")
@ApiOperation(value = "业务支持-关键零部件绑定关系管理-下载模版", notes = "业务支持-关键零部件绑定关系管理-下载模版")
@ApiOperationSupport(order = 7)
@GetMapping(value = "/downloadTemplate")
@RequiresPermissions("keyPartBindingManage:templateDownload")
public ModelAndView downloadTemplate(HttpServletResponse response) {
return lawsPartRelevanceService.downloadTemplate(response);
}
}
@@ -177,4 +177,10 @@ public class LawsPartType implements Serializable {
@Excel(name = "责任部门专业模块", width = 15, dicCode = "responsible_module")
@TableField(exist = false)
private String responsibleModule;
/**
* FND+GPC关联
*/
@ApiModelProperty(value = "FND+GPC关联")
private String fndGpc;
}
@@ -0,0 +1,20 @@
package com.jero.modules.laws.part.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.modules.laws.part.entity.LawsPartType;
import org.apache.ibatis.annotations.Param;
public interface LawsPartTypeMapper extends BaseMapper<LawsPartType> {
IPage<LawsPartType> pageList(Page<LawsPartType> page,
@Param(Constants.WRAPPER) QueryWrapper<LawsPartType> queryWrapper);
}
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jero.modules.laws.part.mapper.LawsPartTypeMapper">
<select id="pageList" resultType="com.jero.modules.laws.part.entity.LawsPartType">
</select>
</mapper>
@@ -0,0 +1,31 @@
package com.jero.modules.laws.part.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.common.api.vo.Result;
import com.jero.modules.laws.part.entity.LawsPartRelevance;
import com.jero.modules.laws.part.entity.LawsPartType;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
public interface ILawsPartTypeService extends IService<LawsPartType> {
IPage<LawsPartType> queryPage(LawsPartType lawsPartType, Integer pageNo, Integer pageSize,
HttpServletRequest req);
LawsPartType queryById(String id);
void deleteById(String id);
void deleteByIds(List<String> ids);
void add(LawsPartType lawsPartType);
void edit(LawsPartType lawsPartType);
void cancellation(LawsPartType lawsPartType);
}
@@ -0,0 +1,94 @@
package com.jero.modules.laws.part.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.api.vo.ResultCommon;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.laws.part.entity.LawsPartType;
import com.jero.modules.laws.part.mapper.LawsPartTypeMapper;
import com.jero.modules.laws.part.service.ILawsPartTypeService;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Objects;
@Service
@Slf4j
public class LawsPartTypeServiceImpl extends ServiceImpl<LawsPartTypeMapper, LawsPartType>
implements ILawsPartTypeService {
@Resource
private LawsPartTypeMapper lawsPartTypeMapper;
@Override
public IPage<LawsPartType> queryPage(LawsPartType lawsPartType, Integer pageNo,
Integer pageSize, HttpServletRequest req) {
QueryWrapper<LawsPartType> queryWrapper =
QueryGenerator.initQueryWrapper(lawsPartType, req.getParameterMap());
Page<LawsPartType> page = new Page<>(pageNo, pageSize);
IPage<LawsPartType> re = lawsPartTypeMapper.pageList(page, queryWrapper);
return re;
}
@Override
public LawsPartType queryById(String id) {
LawsPartType lawsPartType = getById(id);
if(Objects.isNull(lawsPartType)){
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
lawsPartType.setRegPartNameCn(lawsPartType.getFndGpc());
return lawsPartType;
}
@Override
public void deleteById(String id) {
LawsPartType lawsPartType = getById(id);
if(Objects.isNull(lawsPartType)){
throw new JeroBootException(ResultCommon.NO_CORRESPONDING_DATA_FOUND);
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if(!Objects.equals(lawsPartType.getCreateBy(),sysUser.getUsername())){
throw new JeroBootException(ResultCommon.NO_PERMISSION);
}
removeById(id);
}
@Override
@Transactional(rollbackFor = JeroBootException.class)
public void deleteByIds(List<String> ids) {
for (String id : ids) {
deleteById(id);
}
removeByIds(ids);
}
@Override
public void add(LawsPartType lawsPartType) {
save(lawsPartType);
}
@Override
public void edit(LawsPartType lawsPartType) {
updateById(lawsPartType);
}
@Override
public void cancellation(LawsPartType lawsPartType) {
}
}