Explorar o código

fix: 岗位导入时岗位名称字典数据添加顺序后调

zhangying hai 9 meses
pai
achega
3708554f04

+ 9 - 3
src/main/java/com/hz/employmentsite/services/impl/companyService/PostServiceImpl.java

@@ -398,7 +398,10 @@ public class PostServiceImpl implements PostService {
         List<SysDictionaryItem> dicCultureDataList = dictionaryService.getDictionaryItemList("CultureLevel");
         // 工作年限
         List<SysDictionaryItem> dicWorkYearDataList = dictionaryService.getDictionaryItemList("WorkYearType");
-        List<PostVo> resultList = new ArrayList<>();
+
+        // 最终处理数据
+        List<PostVo> resultList = new ArrayList<>(); // 岗位
+        List<PcProfession> pcProfessionList = new ArrayList<>(); // 岗位字典
 
         // 获取二级的“其他”岗位
         PcProfessionExample proEmp = new PcProfessionExample();
@@ -438,8 +441,7 @@ public class PostServiceImpl implements PostService {
                         proModel.setProfessionName(item.getProfessionName());
                         proModel.setStatus(Integer.parseInt("1"));
                         proModel.setOrderNo(proOtherSonList.size() + 1);
-
-                        pcProfessionMapper.insert(proModel);
+                        pcProfessionList.add(proModel);
                     }
                 }
             }
@@ -492,6 +494,10 @@ public class PostServiceImpl implements PostService {
         resultList.forEach(item -> {
             save(item, userID);
         });
+        // 添加岗位名称字典
+        pcProfessionList.forEach(item -> {
+            pcProfessionMapper.insert(item);
+        });
         return null;
     }
 }