|
|
@@ -230,12 +230,14 @@ public class DeptPortraitServiceImpl implements IDeptPortraitService {
|
|
230
|
230
|
.distinct()
|
|
231
|
231
|
.collect(Collectors.toList());
|
|
232
|
232
|
|
|
233
|
|
- // 4. 批量查询岗位信息(一次SQL)
|
|
|
233
|
+ // 4. 批量查询岗位信息
|
|
234
|
234
|
Map<Long, String> postIdToNameMap = new HashMap<>();
|
|
235
|
|
- for (Long postId : postIds) {
|
|
236
|
|
- SysPost post = sysPostMapper.selectPostById(postId);
|
|
237
|
|
- if (post != null && post.getPostName() != null) {
|
|
238
|
|
- postIdToNameMap.put(postId, post.getPostName());
|
|
|
235
|
+ if (!postIds.isEmpty()) {
|
|
|
236
|
+ List<SysPost> posts = sysPostMapper.selectPostsByIds(postIds);
|
|
|
237
|
+ for (SysPost post : posts) {
|
|
|
238
|
+ if (post != null && post.getPostName() != null) {
|
|
|
239
|
+ postIdToNameMap.put(post.getPostId(), post.getPostName());
|
|
|
240
|
+ }
|
|
239
|
241
|
}
|
|
240
|
242
|
}
|
|
241
|
243
|
|