diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/SysFactoryController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/SysFactoryController.java index 5227fb5e..e5ef571c 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/SysFactoryController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/SysFactoryController.java @@ -72,7 +72,13 @@ public class SysFactoryController extends BaseController { @Log(title = "工厂模型", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody SysFactory sysFactory) { - return toAjax(sysFactoryService.insertSysFactory(sysFactory)); + if (sysFactoryService.checkFactoryCodeUnique(sysFactory)) { + return AjaxResult.error("组织编码已存在!"); + }else if(sysFactoryService.checkFactoryNameUnique(sysFactory)){ + return AjaxResult.error("组织名称已存在!"); + }else{ + return toAjax(sysFactoryService.insertSysFactory(sysFactory)); + } } /** diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/SysFactoryMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/SysFactoryMapper.java index cc2b8d96..6099da20 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/SysFactoryMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/SysFactoryMapper.java @@ -60,4 +60,8 @@ public interface SysFactoryMapper { public int deleteSysFactoryByFactoryIds(Long[] factoryIds); public List getWorkCenterList(SysFactory sysFactory); + + //新增判断 + String checkFactoryNameUnique(SysFactory sysFactory); + String checkFactoryCodeUnique(SysFactory sysFactory); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/ISysFactoryService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/ISysFactoryService.java index 5d9f879b..ce4f9743 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/ISysFactoryService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/ISysFactoryService.java @@ -60,4 +60,8 @@ public interface ISysFactoryService { //好 List getWorkCenterList(SysFactory sysFactory); + + //新增 判断逻辑 + boolean checkFactoryCodeUnique(SysFactory sysFactory); + boolean checkFactoryNameUnique(SysFactory sysFactory); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/SysFactoryServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/SysFactoryServiceImpl.java index 2d30269c..edfec7c2 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/SysFactoryServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/SysFactoryServiceImpl.java @@ -110,4 +110,36 @@ public class SysFactoryServiceImpl implements ISysFactoryService { return sysFactoryMapper.getWorkCenterList(sysFactory); } + /** + * 判断组织信息 + * + * @return 结果 + */ + @Override + @DS("#header.poolName") + public boolean checkFactoryCodeUnique(SysFactory sysFactory) { + String area = sysFactoryMapper.checkFactoryCodeUnique(sysFactory); + if(area == null){ + return false; + }else{ + return true; + } + } + + /** + * 判断组织信息 + * + * @return 结果 + */ + @Override + @DS("#header.poolName") + public boolean checkFactoryNameUnique(SysFactory sysFactory) { + String desc = sysFactoryMapper.checkFactoryNameUnique(sysFactory); + if(desc== null){ + return false; + }else{ + return true; + } + } + } diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/SysFactoryMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/SysFactoryMapper.xml index 1d7e9d75..76bafb0c 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/SysFactoryMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/SysFactoryMapper.xml @@ -32,6 +32,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and parent_id = #{parentId} and ancestors = #{ancestors} and factory_name like concat('%', #{factoryName}, '%') + and factory_code like concat('%', #{factoryCode}, '%') and order_num = #{orderNum} and leader = #{leader} and phone = #{phone} @@ -118,4 +119,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" from sys_factory + + + + \ No newline at end of file