czh 2 лет назад
Родитель
Сommit
727fdedd79

+ 1 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/web/constant/HttpStatus.java

@@ -182,5 +182,6 @@ public class HttpStatus {
     public static final String MSG_029 = "合同编号超长!";
     public static final String MSG_030 = "合同名称超长!";
     public static final String MSG_031 = "您与所选企业存在未完结业务,当前无法删除!";
+    public static final String MSG_033 = "当前企业资质在审核中,无法删除!";
 
 }

+ 9 - 0
sckw-modules/sckw-system/src/main/java/com/sckw/system/dao/KwsEnterpriseDao.java

@@ -50,6 +50,15 @@ public interface KwsEnterpriseDao {
      */
     List<KwsEnterprise> selectByKeys(@Param(value = "list") List<Long> list);
 
+    /**
+     * @param list 主键Ids
+     * @return KwsEnterprise
+     * @desc: 批量查
+     * @author: czh
+     * @date: 2023/6/19
+     */
+    List<KwsEnterprise> selectAllByKeys(@Param(value = "list") List<Long> list);
+
     /**
      * 查询
      * @param params

+ 4 - 1
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -95,7 +95,7 @@ public class KwsEnterpriseService {
     public void deleteByKey(String ids) throws SystemException {
         //校验,有员工还在企业下则不能删除
         List<Long> list = Arrays.stream(ids.split(",")).map(Long::parseLong).toList();
-        List<KwsEnterprise> kwsEnterprises = kwsEnterpriseDao.selectByKeys(list);
+        List<KwsEnterprise> kwsEnterprises = kwsEnterpriseDao.selectAllByKeys(list);
         if (CollectionUtils.isEmpty(kwsEnterprises)) {
             throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.ENT_NOT_EXISTS);
         }
@@ -108,6 +108,9 @@ public class KwsEnterpriseService {
         /*1、删除企业*/
         for (KwsEnterprise kwsEnterprise : kwsEnterprises) {
             kwsEnterprise.setDelFlag(Global.YES);
+            if (kwsEnterprise.getApproval().equals(ApprovalEnum.PROCESS.getCode())) {
+                throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.MSG_033);
+            }
             if (kwsEnterpriseDao.update(kwsEnterprise) <= 0) {
                 throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.DELETE_FAIL);
             }

+ 13 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsEnterpriseDao.xml

@@ -270,6 +270,19 @@
     select * from kws_enterprise where (firm_name = #{entName} or phone = #{phone}) and del_flag = 0 and approval in (1,3,4)
   </select>
 
+  <select id="selectAllByKeys" resultType="com.sckw.system.model.KwsEnterprise">
+    select
+    <include refid="Base_Column_List" />
+    from kws_enterprise
+    where del_flag = 0
+    <if test="list != null and list.size() > 0">
+      and id in
+      <foreach collection="list" item="item" open="(" close=")" separator=",">
+        #{item}
+      </foreach>
+    </if>
+  </select>
+
   <insert id="insert" parameterType="com.sckw.system.model.KwsEnterprise">
     insert into kws_enterprise
     <trim prefix="(" suffix=")" suffixOverrides=",">