diff --git a/src/main/java/com/glxp/api/controller/basic/BasicProductCategoryController.java b/src/main/java/com/glxp/api/controller/basic/BasicProductCategoryController.java index c446abf4..11ad3786 100644 --- a/src/main/java/com/glxp/api/controller/basic/BasicProductCategoryController.java +++ b/src/main/java/com/glxp/api/controller/basic/BasicProductCategoryController.java @@ -131,7 +131,7 @@ public class BasicProductCategoryController { } @GetMapping("/udiwms/basic/product/category/delect") - @Log(title = "单据管理", businessType = BusinessType.DELETE) + @Log(title = "物资分类删除", businessType = BusinessType.DELETE) public BaseResponse delect(BasicProductTypeRequest basicProductTypeRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { @@ -157,8 +157,8 @@ public class BasicProductCategoryController { } @GetMapping("/udiwms/basic/product/category/getTree") - public BaseResponse getTree() { - List treeList = basicProductCategoryService.getTreeList(); + public BaseResponse getTree(BasicProductTypeRequest basicProductTypeRequest) { + List treeList = basicProductCategoryService.getTreeList(basicProductTypeRequest); return ResultVOUtils.success(treeList); } diff --git a/src/main/java/com/glxp/api/dao/basic/BasicProductCategoryMapper.java b/src/main/java/com/glxp/api/dao/basic/BasicProductCategoryMapper.java index ed4240be..9f6db777 100644 --- a/src/main/java/com/glxp/api/dao/basic/BasicProductCategoryMapper.java +++ b/src/main/java/com/glxp/api/dao/basic/BasicProductCategoryMapper.java @@ -2,6 +2,7 @@ package com.glxp.api.dao.basic; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.glxp.api.entity.basic.BasicProductCategory; +import com.glxp.api.req.basic.BasicProductTypeRequest; import com.glxp.api.res.basic.BasicProductCategoryTypeResponse; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -10,7 +11,9 @@ import java.util.List; @Mapper public interface BasicProductCategoryMapper extends BaseMapper { - List getTreeList(); + + List getTreeList(BasicProductTypeRequest basicProductTypeRequest); + List selectLowTypeAll(@Param("code") String code); Long selectProductByRelCode(@Param("relCode") String relCode); diff --git a/src/main/java/com/glxp/api/entity/basic/BasicProductCategory.java b/src/main/java/com/glxp/api/entity/basic/BasicProductCategory.java index 43d6c85a..26e77e69 100644 --- a/src/main/java/com/glxp/api/entity/basic/BasicProductCategory.java +++ b/src/main/java/com/glxp/api/entity/basic/BasicProductCategory.java @@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; + import java.util.Date; + import lombok.Data; /** @@ -63,4 +65,16 @@ public class BasicProductCategory { */ @TableField(value = "updateUser") private String updateUser; -} \ No newline at end of file + + /** + * 部门 + */ + @TableField(value = "deptCode") + private String deptCode; + + /** + * 仓库 + */ + @TableField(value = "invCode") + private String invCode; +} diff --git a/src/main/java/com/glxp/api/req/basic/BasicProductTypeRequest.java b/src/main/java/com/glxp/api/req/basic/BasicProductTypeRequest.java index 7f262a46..796228a4 100644 --- a/src/main/java/com/glxp/api/req/basic/BasicProductTypeRequest.java +++ b/src/main/java/com/glxp/api/req/basic/BasicProductTypeRequest.java @@ -7,10 +7,13 @@ import java.util.List; @Data public class BasicProductTypeRequest { - private Long id; - private String code; - private String parentCode; - private String name; - private String remark; - List ids; + private Long id; + private String code; + private String parentCode; + private String name; + private String remark; + private String deptCode; + private String invCode; + + List ids; } diff --git a/src/main/java/com/glxp/api/service/basic/BasicProductCategoryServiceImpl.java b/src/main/java/com/glxp/api/service/basic/BasicProductCategoryServiceImpl.java index eb5956c5..44f227da 100644 --- a/src/main/java/com/glxp/api/service/basic/BasicProductCategoryServiceImpl.java +++ b/src/main/java/com/glxp/api/service/basic/BasicProductCategoryServiceImpl.java @@ -36,28 +36,26 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ BasicProductCategoryRelMapper basicProductCategoryRelMapper; - @Override - public List getTreeList() { - - return basicProductCategoryMapper.getTreeList(); + public List getTreeList(BasicProductTypeRequest basicProductTypeRequest) { + return basicProductCategoryMapper.getTreeList(basicProductTypeRequest); } @Override public BasicProductCategory selectBasicHospTypeEntity() { QueryWrapper Wrapper = new QueryWrapper<>(); - Wrapper.eq("code",10000).last("limit 1"); + Wrapper.eq("code", 10000).last("limit 1"); return basicProductCategoryMapper.selectOne(Wrapper); } @Override public List getMenuList(BasicProductTypeFilterRequest basicProductTypeFilterRequest) { - QueryWrapper ew=new QueryWrapper<>(); - ew.ne("code",10000); - if(basicProductTypeFilterRequest.getType()!=null && basicProductTypeFilterRequest.getType()==1 && StrUtil.isNotEmpty(basicProductTypeFilterRequest.getCode())){ + QueryWrapper ew = new QueryWrapper<>(); + ew.ne("code", 10000); + if (basicProductTypeFilterRequest.getType() != null && basicProductTypeFilterRequest.getType() == 1 && StrUtil.isNotEmpty(basicProductTypeFilterRequest.getCode())) { List basicProductCategories = basicProductCategoryMapper.selectLowTypeAll(basicProductTypeFilterRequest.getCode()); List ids = basicProductCategories.stream().map(BasicProductCategory::getId).collect(Collectors.toList()); - ew.notIn("id",ids); + ew.notIn("id", ids); } List list = basicProductCategoryMapper.selectList(ew); return list; @@ -65,29 +63,29 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ @Override public Boolean checkName(BasicProductTypeRequest basicProductTypeRequest, Integer type) { - Long sum=null; + Long sum = null; //1添加 - if(type==1){ + if (type == 1) { //查看名字是不是重复 - QueryWrapper ew=new QueryWrapper<>(); - ew.eq("name",basicProductTypeRequest.getName()); - sum=basicProductCategoryMapper.selectCount(ew); - }else{ - QueryWrapper ew=new QueryWrapper<>(); - ew.eq("name",basicProductTypeRequest.getName()); - ew.ne("id",basicProductTypeRequest.getId()); - sum=basicProductCategoryMapper.selectCount(ew); + QueryWrapper ew = new QueryWrapper<>(); + ew.eq("name", basicProductTypeRequest.getName()); + sum = basicProductCategoryMapper.selectCount(ew); + } else { + QueryWrapper ew = new QueryWrapper<>(); + ew.eq("name", basicProductTypeRequest.getName()); + ew.ne("id", basicProductTypeRequest.getId()); + sum = basicProductCategoryMapper.selectCount(ew); } - if(sum>0){ + if (sum > 0) { return false; - }else{ + } else { return true; } } @Override public boolean updateBasicHospType(BasicProductTypeRequest basicProductTypeRequest) { - boolean falg=true; + boolean falg = true; BasicProductCategory basicProductCategory = new BasicProductCategory(); basicProductCategory.setId(basicProductTypeRequest.getId()); basicProductCategory.setCreateTime(new Date()); @@ -95,19 +93,19 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ basicProductCategory.setName(basicProductTypeRequest.getName()); basicProductCategory.setParentCode(basicProductTypeRequest.getParentCode()); basicProductCategory.setRemark(basicProductTypeRequest.getRemark()); - Long userId=customerService.getUserId(); - basicProductCategory.setCreateUser(userId+""); - basicProductCategory.setUpdateUser(userId+""); + Long userId = customerService.getUserId(); + basicProductCategory.setCreateUser(userId + ""); + basicProductCategory.setUpdateUser(userId + ""); int i = basicProductCategoryMapper.updateById(basicProductCategory); - if(i == 0){ - falg=false; + if (i == 0) { + falg = false; } return falg; } @Override public Boolean saveBasicHospType(BasicProductTypeRequest basicProductTypeRequest) { - boolean falg=true; + boolean falg = true; BasicProductCategory basicProductCategory = new BasicProductCategory(); basicProductCategory.setId(basicProductTypeRequest.getId()); basicProductCategory.setCreateTime(new Date()); @@ -115,34 +113,34 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ basicProductCategory.setName(basicProductTypeRequest.getName()); basicProductCategory.setParentCode(basicProductTypeRequest.getParentCode()); basicProductCategory.setRemark(basicProductTypeRequest.getRemark()); - Long userId=customerService.getUserId(); - basicProductCategory.setCreateUser(userId+""); - basicProductCategory.setUpdateUser(userId+""); + Long userId = customerService.getUserId(); + basicProductCategory.setCreateUser(userId + ""); + basicProductCategory.setUpdateUser(userId + ""); //获取数据库最大的code - QueryWrapper ew=new QueryWrapper<>(); + QueryWrapper ew = new QueryWrapper<>(); ew.select("max(code) as code"); BasicProductCategory basicProductCategory1 = basicProductCategoryMapper.selectOne(ew); - basicProductCategory.setCode(Integer.valueOf(basicProductCategory1.getCode())+1+""); + basicProductCategory.setCode(Integer.valueOf(basicProductCategory1.getCode()) + 1 + ""); basicProductCategory.setId(IdUtil.getSnowflakeNextId()); int insert = basicProductCategoryMapper.insert(basicProductCategory); - if(insert == 0){ - falg=false; + if (insert == 0) { + falg = false; } return falg; } @Override public String delectBasicHospType(BasicProductTypeRequest basicProductTypeRequest) { - //查询是否有自己的子集 - QueryWrapper ew=new QueryWrapper<>(); - ew.eq("parentCode",basicProductTypeRequest.getCode()); - Long count=basicProductCategoryMapper.selectCount(ew); - if(count>0){ + //查询是否有自己的子集 + QueryWrapper ew = new QueryWrapper<>(); + ew.eq("parentCode", basicProductTypeRequest.getCode()); + Long count = basicProductCategoryMapper.selectCount(ew); + if (count > 0) { return "请先删除该节点底下的数据!"; } //查询是否有绑定产品 - count = basicProductCategoryMapper.selectProductByRelCode(basicProductTypeRequest.getCode()); - if(count >0){ + count = basicProductCategoryMapper.selectProductByRelCode(basicProductTypeRequest.getCode()); + if (count > 0) { return "该节点还存在产品,请先删除!"; } basicProductCategoryMapper.deleteById(basicProductTypeRequest.getId()); @@ -166,34 +164,34 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ @Override public boolean insertCateRel(BasicProductTypeRequest basicProductTypeRequest) { BasicProductCategoryRel basicProductCategoryRel = new BasicProductCategoryRel(); - int insert =0; + int insert = 0; for (String id : basicProductTypeRequest.getIds()) { basicProductCategoryRel.setRelId(id); basicProductCategoryRel.setCode(basicProductTypeRequest.getCode()); - insert = basicProductCategoryRelMapper.insert(basicProductCategoryRel); + insert = basicProductCategoryRelMapper.insert(basicProductCategoryRel); } - return insert>0; + return insert > 0; } @Override public BasicProductCategory checkCode(String parentCode) { - return basicProductCategoryMapper.selectOne(new QueryWrapper().eq("code",parentCode).last("limit 1")); + return basicProductCategoryMapper.selectOne(new QueryWrapper().eq("code", parentCode).last("limit 1")); } @Override public boolean deleterelByid(Integer id) { - return basicProductCategoryRelMapper.deleteById(id)>0; + return basicProductCategoryRelMapper.deleteById(id) > 0; } @Override public boolean checkExist(String code) { List list = basicProductCategoryMapper.selectList(new QueryWrapper().eq("parentCode", code)); - if(list != null && list.size()>0){ - return true; - } + if (list != null && list.size() > 0) { + return true; + } return false; } @@ -202,9 +200,9 @@ public class BasicProductCategoryServiceImpl implements BasicProductCategoryServ public boolean checkrel(String code) { List relList = basicProductCategoryRelMapper.selectList(new QueryWrapper().eq("code", code)); - if(relList != null && relList.size() > 0){ - return true; - } + if (relList != null && relList.size() > 0) { + return true; + } return false; } diff --git a/src/main/java/com/glxp/api/service/basic/impl/BasicProductCategoryService.java b/src/main/java/com/glxp/api/service/basic/impl/BasicProductCategoryService.java index d62aa7ef..238ac3f4 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/BasicProductCategoryService.java +++ b/src/main/java/com/glxp/api/service/basic/impl/BasicProductCategoryService.java @@ -11,7 +11,7 @@ import java.util.List; public interface BasicProductCategoryService { - List getTreeList(); + List getTreeList(BasicProductTypeRequest basicProductTypeRequest); BasicProductCategory selectBasicHospTypeEntity(); @@ -39,6 +39,5 @@ public interface BasicProductCategoryService { boolean checkrel(String code); - } diff --git a/src/main/resources/mybatis/mapper/basic/BasicProductCategoryMapper.xml b/src/main/resources/mybatis/mapper/basic/BasicProductCategoryMapper.xml index ceca264d..3f192af3 100644 --- a/src/main/resources/mybatis/mapper/basic/BasicProductCategoryMapper.xml +++ b/src/main/resources/mybatis/mapper/basic/BasicProductCategoryMapper.xml @@ -1,54 +1,56 @@ - - - - - - - - - - - - - - - - id, code, parentCode, `name`, remark, createTime, updateTime, `createUser`, updateUser - + + + + + + + + + + + + + + + + id, code, parentCode, `name`, remark, createTime, updateTime, `createUser`, updateUser + - + - - - + + diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index 59028725..3128ead9 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -73,4 +73,12 @@ CREATE TABLE IF NOT EXISTS `sys_app_version` COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = DYNAMIC; -INSERT ignore INTO `sys_app_version`(`id`, `type`, `versionName`, `versionCode`, `appName`, `createTime`, `downloadUrl`, `updateLog`) VALUES (1, 'udi_wms_new', '3.0.6', 306, 'UDI扫码终端', '2023-10-30 18:42:24', 'http://192.168.1.11:9150/udiwms_new.apk', '1.单据审核移除UDI码异常提示;2优化多项功能'); +INSERT ignore INTO `sys_app_version`(`id`, `type`, `versionName`, `versionCode`, `appName`, `createTime`, `downloadUrl`, + `updateLog`) +VALUES (1, 'udi_wms_new', '3.0.6', 306, 'UDI扫码终端', '2023-10-30 18:42:24', 'http://192.168.1.11:9150/udiwms_new.apk', + '1.单据审核移除UDI码异常提示;2优化多项功能'); + + + +CALL Pro_Temp_ColumnWork('basic_product_category', 'deptCode', 'varchar(255)', 1); +CALL Pro_Temp_ColumnWork('basic_product_category', 'invCode', 'varchar(255)', 1);