dzx hai 1 ano
pai
achega
c32698d0f3

+ 6 - 22
src/main/java/com/xjrsoft/module/teacher/service/impl/TeacherbaseManagerServiceImpl.java

@@ -492,30 +492,12 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
         );
         Map<String, Long> departmentMap = departmentList.stream().collect(Collectors.toMap(Department::getName, Department::getId));
 
-        List<UserDeptRelation> userDeptRelations = userDeptRelationMapper.selectList(
-                new MPJLambdaWrapper<UserDeptRelation>()
-                        .select(UserDeptRelation::getId)
-                        .select(UserDeptRelation.class, x -> VoToColumnUtil.fieldsToColumns(UserDeptRelation.class).contains(x.getProperty()))
-                        .innerJoin(User.class, User::getId, UserDeptRelation::getUserId)
-                        .innerJoin(BaseTeacher.class, BaseTeacher::getUserId, User::getId)
-        );
-        Map<Long, UserDeptRelation> userDeptMap = userDeptRelations.stream().collect(Collectors.toMap(UserDeptRelation::getUserId, x -> x));
-
         List<Post> postList = postService.list(
                 new QueryWrapper<Post>().lambda()
                         .eq(Post::getDeleteMark, DeleteMark.NODELETE.getCode())
         );
         Map<String, Long> postMap = postList.stream().collect(Collectors.toMap(Post::getName, Post::getId));
 
-        List<UserPostRelation> postRelations = userPostRelationService.list(
-                new MPJLambdaWrapper<UserPostRelation>()
-                        .select(UserPostRelation::getId)
-                        .select(UserPostRelation.class, x -> VoToColumnUtil.fieldsToColumns(UserPostRelation.class).contains(x.getProperty()))
-                        .innerJoin(User.class, User::getId, UserPostRelation::getUserId)
-                        .innerJoin(BaseTeacher.class, BaseTeacher::getUserId, User::getId)
-        );
-        Map<Long, UserPostRelation> userPostMap = postRelations.stream().collect(Collectors.toMap(UserPostRelation::getUserId, x -> x));
-
         List<User> updateUserList = new ArrayList<>();
         List<BaseTeacher> updateTeacherList = new ArrayList<>();
         List<UserDeptRelation> updateDeptList = new ArrayList<>();
@@ -536,12 +518,14 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
                 teacher.setEmployType(dictionaryMap.get(rowData.get(6).toString()));
                 updateTeacherList.add(teacher);
 
-                UserDeptRelation userDeptRelation = userDeptMap.get(user.getId());
+                UserDeptRelation userDeptRelation = new UserDeptRelation();
                 userDeptRelation.setDeptId(departmentMap.get(rowData.get(7).toString()));
+                userDeptRelation.setUserId(user.getId());
                 updateDeptList.add(userDeptRelation);
 
-                UserPostRelation postRelation = userPostMap.get(user.getId());
+                UserPostRelation postRelation = new UserPostRelation();
                 postRelation.setPostId(postMap.get(rowData.get(8).toString()));
+                postRelation.setUserId(user.getId());
                 updatePostList.add(postRelation);
                 continue;
             }
@@ -581,11 +565,11 @@ public class TeacherbaseManagerServiceImpl extends MPJBaseServiceImpl<XjrUserMap
         }
         if(!updateDeptList.isEmpty()){
             for (UserDeptRelation relation : updateDeptList) {
-                userDeptRelationMapper.updateById(relation);
+                userDeptRelationMapper.insert(relation);
             }
         }
         if(!updatePostList.isEmpty()){
-            userPostRelationService.updateBatchById(updatePostList);
+            userPostRelationService.saveBatch(updatePostList);
         }
         if(!updateTeacherList.isEmpty()){
             for (BaseTeacher teacher : updateTeacherList) {