|
@@ -14,10 +14,12 @@ import com.xjrsoft.common.utils.RedisUtil;
|
|
|
import com.xjrsoft.config.CommonPropertiesConfig;
|
|
|
import com.xjrsoft.module.organization.entity.User;
|
|
|
import com.xjrsoft.module.organization.entity.UserDeptRelation;
|
|
|
+import com.xjrsoft.module.organization.entity.UserPostRelation;
|
|
|
import com.xjrsoft.module.organization.entity.UserRoleRelation;
|
|
|
import com.xjrsoft.module.organization.mapper.UserDeptRelationMapper;
|
|
|
import com.xjrsoft.module.organization.mapper.UserRoleRelationMapper;
|
|
|
import com.xjrsoft.module.organization.service.IUserDeptRelationService;
|
|
|
+import com.xjrsoft.module.organization.service.IUserPostRelationService;
|
|
|
import com.xjrsoft.module.organization.service.IUserService;
|
|
|
import com.xjrsoft.module.teacher.dto.AddXjrUserDto;
|
|
|
import com.xjrsoft.module.teacher.dto.UpdateXjrUserDto;
|
|
@@ -73,6 +75,7 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
|
|
|
private final UserDeptRelationMapper userDeptRelationMapper;
|
|
|
private final IUserService userService;
|
|
|
private final CommonPropertiesConfig propertiesConfig;
|
|
|
+ private final IUserPostRelationService userPostRelationService;
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean add(AddXjrUserDto dto) {
|
|
@@ -128,6 +131,22 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
|
|
|
userDeptRelationService.saveBatch(userDeptRelationList);
|
|
|
}
|
|
|
|
|
|
+ List<UserPostRelation> userPostRelationList = new ArrayList<>();
|
|
|
+ if (StrUtil.isNotBlank(dto.getPostIds())) {
|
|
|
+ String allPostIdStr = StrUtil.join(StringPool.COMMA, dto.getPostIds());
|
|
|
+ List<Long> postIds = Arrays.stream(allPostIdStr.split(StringPool.COMMA)).map(Convert::toLong).collect(Collectors.toList());
|
|
|
+ if (CollectionUtil.isNotEmpty(postIds)) {
|
|
|
+ for (Long postId : postIds) {
|
|
|
+ //将用户所选岗位保存到关联表中
|
|
|
+ UserPostRelation userPostRelation = new UserPostRelation();
|
|
|
+ userPostRelation.setUserId(xjrUser.getId());
|
|
|
+ userPostRelation.setPostId(postId);
|
|
|
+ userPostRelationList.add(userPostRelation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ userPostRelationService.saveBatch(userPostRelationList);
|
|
|
+ }
|
|
|
+
|
|
|
// 添加角色
|
|
|
UserRoleRelation userRoleRelation = new UserRoleRelation();
|
|
|
userRoleRelation.setUserId(xjrUser.getId());
|
|
@@ -174,6 +193,23 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
|
|
|
userDeptRelationService.saveBatch(userDeptRelationList);
|
|
|
}
|
|
|
|
|
|
+ userPostRelationService.remove(Wrappers.<UserPostRelation>query().lambda().eq(UserPostRelation::getUserId,xjrUser.getId()));
|
|
|
+ List<UserPostRelation> userPostRelationList = new ArrayList<>();
|
|
|
+ if (StrUtil.isNotBlank(dto.getPostIds())) {
|
|
|
+ String allPostIdStr = StrUtil.join(StringPool.COMMA, dto.getPostIds());
|
|
|
+ List<Long> postIds = Arrays.stream(allPostIdStr.split(StringPool.COMMA)).map(Convert::toLong).collect(Collectors.toList());
|
|
|
+ if (CollectionUtil.isNotEmpty(postIds)) {
|
|
|
+ for (Long postId : postIds) {
|
|
|
+ //将用户所选岗位保存到关联表中
|
|
|
+ UserPostRelation userPostRelation = new UserPostRelation();
|
|
|
+ userPostRelation.setUserId(xjrUser.getId());
|
|
|
+ userPostRelation.setPostId(postId);
|
|
|
+ userPostRelationList.add(userPostRelation);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ userPostRelationService.saveBatch(userPostRelationList);
|
|
|
+ }
|
|
|
+
|
|
|
//********************************* BaseTeacher 增删改 开始 *******************************************/
|
|
|
{
|
|
|
// 查出所有子级的id
|