From 3464268b0c9d8cf66c0fc91ce1dab0e4a0b6d969 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Fri, 15 Sep 2023 15:57:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E4=BF=A1=E6=81=AF=E7=8F=AD?= =?UTF-8?q?=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/op/wms/domain/BaseTeamUser.java | 25 +++++++- .../com/op/wms/mapper/BaseTeamUserMapper.java | 4 ++ .../service/impl/BaseTeamTServiceImpl.java | 60 ++++++++++++++----- .../mapper/wms/BaseTeamUserMapper.xml | 16 ++++- 4 files changed, 87 insertions(+), 18 deletions(-) diff --git a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamUser.java b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamUser.java index e825fd89..2533d533 100644 --- a/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamUser.java +++ b/op-modules/op-wms/src/main/java/com/op/wms/domain/BaseTeamUser.java @@ -29,10 +29,18 @@ public class BaseTeamUser extends BaseEntity { @Excel(name = "人员id") private String userId; - /** 人员名字 */ + /** 人员名字编号 */ @Excel(name = "人员名字") private String userName; + /** 人员名字 */ + @Excel(name = "人员名字") + private String nickName; + + /** 人员拼接名字 */ + @Excel(name = "人员拼接名字") + private String teamUserName; + public void setId(String id) { this.id = id; } @@ -64,11 +72,24 @@ public class BaseTeamUser extends BaseEntity { public void setUserName(String userName) { this.userName = userName; } - public String getUserName() { return userName; } + public String getNickName() { + return nickName; + } + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public String getTeamUserName() { + return teamUserName; + } + public void setTeamUserName(String teamUserName) { + this.teamUserName = teamUserName; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) 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 998e2bc7..40eb3cd3 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 @@ -68,4 +68,8 @@ public interface BaseTeamUserMapper { //查询人员ID public String selectId(BaseTeamUser baseTeamUser); + @DS("master") + public String selectUserName(BaseTeamUser baseTeamUser); + //批量删除 + public void deleteBaseTeamUserByTeamId(String teamId); } 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 6e30f06b..57e98806 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,6 +69,33 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService { public int insertBaseTeamT(BaseTeamT baseTeamT) { baseTeamT.setCreateDate(DateUtils.getNowDate()); baseTeamT.setCreateBy(SecurityUtils.getUsername()); + //删掉当前关联重新建 + baseTeamUserMapper.deleteBaseTeamUserByTeamId(baseTeamT.getTeamId()); + for(int i = 0;i list = new ArrayList<>(); + list = baseTeamT.getRightData(); + String userId = list.get(i); + baseTeamUser.setUserId(userId); + String userName = baseTeamUserMapper.selectUserName(baseTeamUser); + //判断班组人员有没有变动 挨个遍历 + 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); } @@ -83,29 +110,32 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService { public int updateBaseTeamT(BaseTeamT baseTeamT) { baseTeamT.setLastUpdateDate(DateUtils.getNowDate()); baseTeamT.setLastUpdateBy(SecurityUtils.getUsername()); + //删掉当前关联重新建 + baseTeamUserMapper.deleteBaseTeamUserByTeamId(baseTeamT.getTeamId()); for(int i = 0;i list = new ArrayList<>(); list = baseTeamT.getRightData(); String userId = list.get(i); baseTeamUser.setUserId(userId); - BaseTeamUser baseTeamUser1 = new BaseTeamUser(); - List members = baseTeamUserMapper.selectTeamMembersIds(baseTeamUser1); - boolean bool = members.contains(userId); - if(bool == true){ - //倒查id - String id = baseTeamUserMapper.selectId(baseTeamUser); - baseTeamUser.setUpdateTime(DateUtils.getNowDate()); - baseTeamUser.setUpdateBy(SecurityUtils.getUsername()); - baseTeamUserMapper.updateBaseTeamUser(baseTeamUser); - }else{ - baseTeamUser.setCreateBy(SecurityUtils.getUsername()); - baseTeamUser.setCreateTime(DateUtils.getNowDate()); - baseTeamUser.setId(IdUtils.fastSimpleUUID()); - baseTeamUserMapper.insertBaseTeamUser(baseTeamUser); - } + String userName = baseTeamUserMapper.selectUserName(baseTeamUser); + //判断班组人员有没有变动 挨个遍历 + 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.updateBaseTeamT(baseTeamT); } 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 5b793d04..48a65701 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 @@ -80,6 +80,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" delete from base_team_user where id = #{id} + + delete from base_team_user where team_id = #{teamId} + + delete from base_team_user where id in @@ -88,7 +92,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -110,4 +118,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and team_id = #{teamId} + + \ No newline at end of file