Merge remote-tracking branch 'origin/master'

highway
wws 1 year ago
commit 2ec12ec09a

@ -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)

@ -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);
}

@ -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<baseTeamT.getRightData().size();i++){
BaseTeamUser baseTeamUser = new BaseTeamUser();
baseTeamUser.setCreateBy(SecurityUtils.getUsername());
baseTeamUser.setCreateTime(DateUtils.getNowDate());
baseTeamUser.setTeamId(baseTeamT.getTeamId());
baseTeamUser.setTeamCode(baseTeamT.getTeamCode());
baseTeamUser.setId(IdUtils.fastSimpleUUID());
List<String> 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<String> 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<baseTeamT.getRightData().size();i++){
BaseTeamUser baseTeamUser = new BaseTeamUser();
baseTeamUser.setCreateBy(SecurityUtils.getUsername());
baseTeamUser.setCreateTime(DateUtils.getNowDate());
baseTeamUser.setTeamId(baseTeamT.getTeamId());
baseTeamUser.setTeamCode(baseTeamT.getTeamCode());
baseTeamUser.setId(IdUtils.fastSimpleUUID());
List<String> list = new ArrayList<>();
list = baseTeamT.getRightData();
String userId = list.get(i);
baseTeamUser.setUserId(userId);
BaseTeamUser baseTeamUser1 = new BaseTeamUser();
List<String> 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<String> 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);
}

@ -80,6 +80,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
delete from base_team_user where id = #{id}
</delete>
<delete id="deleteBaseTeamUserByTeamId" parameterType="String">
delete from base_team_user where team_id = #{teamId}
</delete>
<delete id="deleteBaseTeamUserByIds" parameterType="String">
delete from base_team_user where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
@ -88,7 +92,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<select id="selectTeamMembers" parameterType="BaseTeamUser" resultMap="BaseTeamUserResult">
select user_id,user_name
select
user_id,
user_name,
nick_name,
CONCAT(nick_name,user_name) AS teamUserName
from sys_user
</select>
@ -110,4 +118,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and team_id = #{teamId}
</select>
<select id="selectUserName" parameterType="BaseTeamUser" resultType="java.lang.String">
select user_name
from sys_user
where user_id = #{userId}
</select>
</mapper>
Loading…
Cancel
Save