diff --git a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamTController.java b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamTController.java index ed102dc9..9b9e9bf7 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamTController.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/controller/BaseTeamTController.java @@ -74,7 +74,13 @@ public class BaseTeamTController extends BaseController { @Log(title = "班组", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody BaseTeamT baseTeamT) { - return toAjax(baseTeamTService.insertBaseTeamT(baseTeamT)); + if (baseTeamTService.checkTeamCodeUnique(baseTeamT)) { + return AjaxResult.error("班组编码已存在!"); + }else if(baseTeamTService.checkTeamDescUnique(baseTeamT)){ + return AjaxResult.error("班组名称已存在!"); + }else{ + return toAjax(baseTeamTService.insertBaseTeamT(baseTeamT)); + } } /** diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamTMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamTMapper.java index 6c7129e6..c030d5e6 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamTMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamTMapper.java @@ -61,4 +61,8 @@ public interface BaseTeamTMapper { * @return 结果 */ public int deleteBaseTeamTByTeamIds(String[] teamIds); + + String checkTeamCodeUnique(BaseTeamT baseTeamT); + String checkTeamDescUnique(BaseTeamT baseTeamT); + String getBaseTeamTByCode(BaseTeamT baseTeamT); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamUserMapper.java b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamUserMapper.java index 40eb3cd3..7360832a 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamUserMapper.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/mapper/BaseTeamUserMapper.java @@ -72,4 +72,5 @@ public interface BaseTeamUserMapper { public String selectUserName(BaseTeamUser baseTeamUser); //批量删除 public void deleteBaseTeamUserByTeamId(String teamId); + void deleteBaseTeamUserByTeamIds(String[] teamIds); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamTService.java b/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamTService.java index 04d8a75d..62d433ab 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamTService.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/IBaseTeamTService.java @@ -58,4 +58,7 @@ public interface IBaseTeamTService { * @return 结果 */ public int deleteBaseTeamTByTeamId(String teamId); + + boolean checkTeamCodeUnique(BaseTeamT baseTeamT); + boolean checkTeamDescUnique(BaseTeamT baseTeamT); } diff --git a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamTServiceImpl.java b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamTServiceImpl.java index 57e98806..5a73770c 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamTServiceImpl.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/service/impl/BaseTeamTServiceImpl.java @@ -69,13 +69,13 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService { public int insertBaseTeamT(BaseTeamT baseTeamT) { baseTeamT.setCreateDate(DateUtils.getNowDate()); baseTeamT.setCreateBy(SecurityUtils.getUsername()); - //删掉当前关联重新建 - baseTeamUserMapper.deleteBaseTeamUserByTeamId(baseTeamT.getTeamId()); + baseTeamTMapper.insertBaseTeamT(baseTeamT); + String teamId = baseTeamTMapper.getBaseTeamTByCode(baseTeamT); for(int i = 0;i list = new ArrayList<>(); @@ -86,17 +86,8 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService { //判断班组人员有没有变动 挨个遍历 baseTeamUser.setUserName(userName); baseTeamUserMapper.insertBaseTeamUser(baseTeamUser); -// BaseTeamUser baseTeamUser1 = new BaseTeamUser(); -// List members = baseTeamUserMapper.selectTeamMembersIds(baseTeamUser1); -// boolean bool = members.contains(userId); - //倒查id -// String id = baseTeamUserMapper.selectId(baseTeamUser); -// baseTeamUser.setUpdateTime(DateUtils.getNowDate()); -// baseTeamUser.setUpdateBy(SecurityUtils.getUsername()); -// baseTeamUserMapper.updateBaseTeamUser(baseTeamUser); - //如果过来的班组成员ID不存在于表中,直接新增 } - return baseTeamTMapper.insertBaseTeamT(baseTeamT); + return 1; } /** @@ -149,6 +140,7 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService { @Override @DS("#header.poolName") public int deleteBaseTeamTByTeamIds(String[] teamIds) { + baseTeamUserMapper.deleteBaseTeamUserByTeamIds(teamIds); return baseTeamTMapper.deleteBaseTeamTByTeamIds(teamIds); } @@ -161,6 +153,39 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService { @Override @DS("#header.poolName") public int deleteBaseTeamTByTeamId(String teamId) { + baseTeamUserMapper.deleteBaseTeamUserByTeamId(teamId); return baseTeamTMapper.deleteBaseTeamTByTeamId(teamId); } + + /** + * 判断仓库信息 + * + * @return 结果 + */ + @Override + @DS("#header.poolName") + public boolean checkTeamCodeUnique(BaseTeamT baseTeamT) { + String code = baseTeamTMapper.checkTeamCodeUnique(baseTeamT); + if(code == null){ + return false; + }else{ + return true; + } + } + + /** + * 判断仓库信息 + * + * @return 结果 + */ + @Override + @DS("#header.poolName") + public boolean checkTeamDescUnique(BaseTeamT baseTeamT) { + String name = baseTeamTMapper.checkTeamDescUnique(baseTeamT); + if(name == null){ + return false; + }else{ + return true; + } + } } diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamTMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamTMapper.xml index 954896cc..c73bb71e 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamTMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamTMapper.xml @@ -40,9 +40,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and ORG_Id = #{orgId} - and Team_Code = #{teamCode} - and Team_Desc = #{teamDesc} - and Team_Desc_Global = #{teamDescGlobal} + and Team_Code like concat('%', #{teamCode}, '%') + and Team_Desc like concat('%', #{teamDesc}, '%') + and Team_Desc_Global like concat('%', #{teamDescGlobal}, '%') and Team_Desc_Extended = #{teamDescExtended} and Create_By = #{createBy} and Create_Date = #{createDate} @@ -170,4 +170,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{teamId} + + + + + + + \ No newline at end of file diff --git a/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamUserMapper.xml b/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamUserMapper.xml index 48a65701..0be72bbd 100644 --- a/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamUserMapper.xml +++ b/op-modules/op-wms/src/main/resources/mapper/wms/BaseTeamUserMapper.xml @@ -124,4 +124,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where user_id = #{userId} + + delete from base_team_user where team_id in + + #{teamId} + + + \ No newline at end of file