|
|
@ -69,6 +69,33 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
|
|
|
|
public int insertBaseTeamT(BaseTeamT baseTeamT) {
|
|
|
|
public int insertBaseTeamT(BaseTeamT baseTeamT) {
|
|
|
|
baseTeamT.setCreateDate(DateUtils.getNowDate());
|
|
|
|
baseTeamT.setCreateDate(DateUtils.getNowDate());
|
|
|
|
baseTeamT.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
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);
|
|
|
|
return baseTeamTMapper.insertBaseTeamT(baseTeamT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -83,29 +110,32 @@ public class BaseTeamTServiceImpl implements IBaseTeamTService {
|
|
|
|
public int updateBaseTeamT(BaseTeamT baseTeamT) {
|
|
|
|
public int updateBaseTeamT(BaseTeamT baseTeamT) {
|
|
|
|
baseTeamT.setLastUpdateDate(DateUtils.getNowDate());
|
|
|
|
baseTeamT.setLastUpdateDate(DateUtils.getNowDate());
|
|
|
|
baseTeamT.setLastUpdateBy(SecurityUtils.getUsername());
|
|
|
|
baseTeamT.setLastUpdateBy(SecurityUtils.getUsername());
|
|
|
|
|
|
|
|
//删掉当前关联重新建
|
|
|
|
|
|
|
|
baseTeamUserMapper.deleteBaseTeamUserByTeamId(baseTeamT.getTeamId());
|
|
|
|
for(int i = 0;i<baseTeamT.getRightData().size();i++){
|
|
|
|
for(int i = 0;i<baseTeamT.getRightData().size();i++){
|
|
|
|
BaseTeamUser baseTeamUser = new BaseTeamUser();
|
|
|
|
BaseTeamUser baseTeamUser = new BaseTeamUser();
|
|
|
|
|
|
|
|
baseTeamUser.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
|
|
|
|
baseTeamUser.setCreateTime(DateUtils.getNowDate());
|
|
|
|
baseTeamUser.setTeamId(baseTeamT.getTeamId());
|
|
|
|
baseTeamUser.setTeamId(baseTeamT.getTeamId());
|
|
|
|
baseTeamUser.setTeamCode(baseTeamT.getTeamCode());
|
|
|
|
baseTeamUser.setTeamCode(baseTeamT.getTeamCode());
|
|
|
|
|
|
|
|
baseTeamUser.setId(IdUtils.fastSimpleUUID());
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
List<String> list = new ArrayList<>();
|
|
|
|
list = baseTeamT.getRightData();
|
|
|
|
list = baseTeamT.getRightData();
|
|
|
|
String userId = list.get(i);
|
|
|
|
String userId = list.get(i);
|
|
|
|
baseTeamUser.setUserId(userId);
|
|
|
|
baseTeamUser.setUserId(userId);
|
|
|
|
BaseTeamUser baseTeamUser1 = new BaseTeamUser();
|
|
|
|
String userName = baseTeamUserMapper.selectUserName(baseTeamUser);
|
|
|
|
List<String> members = baseTeamUserMapper.selectTeamMembersIds(baseTeamUser1);
|
|
|
|
//判断班组人员有没有变动 挨个遍历
|
|
|
|
boolean bool = members.contains(userId);
|
|
|
|
baseTeamUser.setUserName(userName);
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
return baseTeamTMapper.updateBaseTeamT(baseTeamT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|