Преглед изворни кода

fix: 管理的外出记录删除提示

zhangying пре 3 месеци
родитељ
комит
d8f0ff98a1

+ 19 - 11
src/main/java/com/hz/employmentsite/services/impl/companyService/CompanyServiceImpl.java

@@ -61,6 +61,9 @@ public class CompanyServiceImpl implements CompanyService {
     @Autowired
     private PcPostMapper pcPostMapper;
 
+    @Autowired
+    private PcSigninMapper pcSigninMapper;
+
     @Autowired
     private PcSiteUserMapper pcSiteUserMapper;
 
@@ -322,18 +325,23 @@ public class CompanyServiceImpl implements CompanyService {
             var curCompanyPostList = pcPostMapper.selectByExample(pcPostExp).stream().toList();
             if( curCompanyPostList != null && curCompanyPostList.size() > 0){
                 throw new BaseException("10004","所选企业已有关联岗位信息,不允许删除!");
-            }else{
-                PcCompanyWithBLOBs company = pcCompanyMapper.selectByPrimaryKey(curCompanyID);
-                int count = pcCompanyMapper.deleteByPrimaryKey(curCompanyID);
-                if(count>0){
-                    PcLabelCompanyExample labelEmp = new PcLabelCompanyExample();
-                    labelEmp.or().andCompanyIDEqualTo(curCompanyID);
-                    pcLabelCompanyMapper.deleteByExample(labelEmp);
-                    // 记录被删除的企业信息
-                    delInfo += company.getCompanyName() + ",";
-                }
-                result+=count;
             }
+            PcSigninExample pcSigninExample = new PcSigninExample();
+            pcSigninExample.or().andCompanyIDEqualTo(curCompanyID);
+            List<PcSignin> pcSignins = pcSigninMapper.selectByExample(pcSigninExample).stream().toList();
+            if (pcSignins != null && pcSignins.size() > 0) {
+                throw new BaseException("10004","所选企业已有关联的外出工作走访记录信息,暂时无法删除!");
+            }
+            PcCompanyWithBLOBs company = pcCompanyMapper.selectByPrimaryKey(curCompanyID);
+            int count = pcCompanyMapper.deleteByPrimaryKey(curCompanyID);
+            if(count>0){
+                PcLabelCompanyExample labelEmp = new PcLabelCompanyExample();
+                labelEmp.or().andCompanyIDEqualTo(curCompanyID);
+                pcLabelCompanyMapper.deleteByExample(labelEmp);
+                // 记录被删除的企业信息
+                delInfo += company.getCompanyName() + ",";
+            }
+            result+=count;
         }
         if (result > 0) {
             SysLog sysLog = new SysLog();

+ 20 - 12
src/main/java/com/hz/employmentsite/services/impl/jobUserManager/JobUserServiceImpl.java

@@ -87,6 +87,9 @@ public class JobUserServiceImpl implements JobUserService {
     @Autowired
     private HonorService honorService;
 
+    @Autowired
+    private PcSigninMapper pcSigninMapper;
+
     @Override
     public PageInfo<JobUserVo> getList(Integer pageIndex, Integer pageSize,
                                        List<String> jobUserIDList, String name,
@@ -275,19 +278,24 @@ public class JobUserServiceImpl implements JobUserService {
             var curJobUserHuntList = pcJobhuntMapper.selectByExample(jobHuntExample).stream().toList();
             if( curJobUserHuntList != null && curJobUserHuntList.size()>0){
                 throw new BaseException("10004","所选求职人员已有关联的求职意向,不允许删除!");
-            }else{
-                PcJobuser pcJobuser = pcJobuserMapper.selectByPrimaryKey(curJobUserID);
-                int count = pcJobuserMapper.deleteByPrimaryKey(curJobUserID);
-                if(count>0){
-                    // 记录被删除的求职人员信息
-                    delInfo += pcJobuser.getName() + ",";
-                    // 删除求职人员标签
-                    PcLabelJobuserExample labelEmp = new PcLabelJobuserExample();
-                    labelEmp.or().andJobuserIDEqualTo(curJobUserID);
-                    pcLabelJobuserMapper.deleteByExample(labelEmp);
-                }
-                result+=count;
             }
+            PcSigninExample pcSigninExample = new PcSigninExample();
+            pcSigninExample.or().andJobuserIDEqualTo(curJobUserID);
+            List<PcSignin> pcSignins = pcSigninMapper.selectByExample(pcSigninExample).stream().toList();
+            if (pcSignins != null && pcSignins.size() > 0) {
+                throw new BaseException("10004","所选企业已有关联的外出工作走访记录信息,暂时无法删除!");
+            }
+            PcJobuser pcJobuser = pcJobuserMapper.selectByPrimaryKey(curJobUserID);
+            int count = pcJobuserMapper.deleteByPrimaryKey(curJobUserID);
+            if(count>0){
+                // 记录被删除的求职人员信息
+                delInfo += pcJobuser.getName() + ",";
+                // 删除求职人员标签
+                PcLabelJobuserExample labelEmp = new PcLabelJobuserExample();
+                labelEmp.or().andJobuserIDEqualTo(curJobUserID);
+                pcLabelJobuserMapper.deleteByExample(labelEmp);
+            }
+            result+=count;
         }
         if (result > 0) {
             SysLog sysLog = new SysLog();