Commit d03b29ca authored by mengbali153's avatar mengbali153

培训计划

parent d97611b9
...@@ -94,35 +94,15 @@ public class PlanTrainingServiceImpl extends ServiceImpl<PlanTrainingMapper, Pla ...@@ -94,35 +94,15 @@ public class PlanTrainingServiceImpl extends ServiceImpl<PlanTrainingMapper, Pla
if (save) { if (save) {
Integer planId = cama.getId(); Integer planId = cama.getId();
//todo 培训关联表对象 ==>plant + 基本用户信息 //todo 培训关联表对象 ==>plant + 基本用户信息
//拆分用户id
String userIds = query.getUserIds();
String[] split = userIds.split("、");
List<PlanPeople> batchAdd = new ArrayList<>(); List<PlanPeople> batchAdd = new ArrayList<>();
//为每个用户id创建关联表信息s if (query.getUserIds()!=null) {
for (String userId : split) { //拆分用户id
Integer id = Integer.parseInt(userId); String userIds = query.getUserIds();
UserVo user = sysUserMapper.getById(id); String[] split = userIds.split("、");
PlanPeople planPeople = new PlanPeople(); //为每个用户id创建关联表信息s
planPeople.setPlanId(planId); for (String userId : split) {
planPeople.setUserId(user.getId()); Integer id = Integer.parseInt(userId);
planPeople.setName(user.getName()); UserVo user = sysUserMapper.getById(id);
planPeople.setAccount(user.getUsername());
planPeople.setGroupId(user.getGroupId());
batchAdd.add(planPeople);
cama.setPlanObject(cama.getPlanObject() + user.getName() + "、");
}
//传的GroupIds
String groupIds = query.getGroupIds();
String[] split1 = groupIds.split("、");
List<PlanPeople> batchAdd1 = new ArrayList<>();
for (String groupId : split1) {
int gpId = Integer.parseInt(groupId);
QueryWrapper<SysUser> qw = new QueryWrapper<>();
qw.eq("group_id", gpId);
List<SysUser> sysUsers = sysUserMapper.selectList(qw);
for (SysUser user : sysUsers) {
PlanPeople planPeople = new PlanPeople(); PlanPeople planPeople = new PlanPeople();
planPeople.setPlanId(planId); planPeople.setPlanId(planId);
planPeople.setUserId(user.getId()); planPeople.setUserId(user.getId());
...@@ -131,6 +111,31 @@ public class PlanTrainingServiceImpl extends ServiceImpl<PlanTrainingMapper, Pla ...@@ -131,6 +111,31 @@ public class PlanTrainingServiceImpl extends ServiceImpl<PlanTrainingMapper, Pla
planPeople.setGroupId(user.getGroupId()); planPeople.setGroupId(user.getGroupId());
batchAdd.add(planPeople); batchAdd.add(planPeople);
cama.setPlanObject(cama.getPlanObject() + user.getName() + "、");
}
}
if (query.getGroupIds()!=null) {
//传的GroupIds
String groupIds = query.getGroupIds();
String[] split1 = groupIds.split("、");
List<PlanPeople> batchAdd1 = new ArrayList<>();
for (String groupId : split1) {
int gpId = Integer.parseInt(groupId);
QueryWrapper<SysUser> qw = new QueryWrapper<>();
qw.eq("group_id", gpId);
List<SysUser> sysUsers = sysUserMapper.selectList(qw);
for (SysUser user : sysUsers) {
PlanPeople planPeople = new PlanPeople();
planPeople.setPlanId(planId);
planPeople.setUserId(user.getId());
planPeople.setName(user.getName());
planPeople.setAccount(user.getUsername());
planPeople.setGroupId(user.getGroupId());
batchAdd.add(planPeople);
cama.setPlanObject(cama.getPlanObject() + user.getName() + "、");
}
} }
} }
iPlantPeopleService.saveBatch(batchAdd); iPlantPeopleService.saveBatch(batchAdd);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment