15928045575 2 лет назад
Родитель
Сommit
56566669ba

+ 12 - 2
sckw-modules/sckw-system/src/main/java/com/sckw/system/service/KwsEnterpriseService.java

@@ -290,8 +290,18 @@ public class KwsEnterpriseService {
             typeList = listByEntId.stream().map(KwsEntType::getType).toList();
         }
         List<Integer> finalTypeList = typeList;
+        if (CollectionUtils.isNotEmpty(listByEntId)) {
+            for (KwsEntType listId : listByEntId) {
+                KwsEntType kwsEntType = new KwsEntType();
+                kwsEntType.setId(listId.getId());
+                kwsEntType.setDelFlag(Global.YES);
+                if (kwsEntTypeDao.update(kwsEntType) <= 0) {
+                    throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.UPDATE_FAIL);
+                }
+            }
+        }
         Arrays.stream(reqVo.getEntTypes().split(",")).toList().forEach(item -> {
-            if (!finalTypeList.contains(item)) {
+            //if (!finalTypeList.contains(Integer.parseInt(item))) {
                 KwsEntType kwsEntType = new KwsEntType();
                 kwsEntType.setEntId(entId);
                 kwsEntType.setType(Integer.parseInt(item));
@@ -305,7 +315,7 @@ public class KwsEnterpriseService {
                 if (kwsEntTypeDao.insert(kwsEntType) <= 0) {
                     throw new SystemException(HttpStatus.CRUD_FAIL_CODE, HttpStatus.INSERT_FAIL);
                 }
-            }
+            //}
         });
 
         /*3、存企业证书*/

+ 34 - 0
sckw-modules/sckw-system/src/main/resources/mapper/KwsEntTypeDao.xml

@@ -87,6 +87,40 @@
     </trim>
   </insert>
 
+  <update id="update" parameterType="com.sckw.system.model.KwsEntType">
+    update kws_ent_type
+    <set>
+      <if test="entId != null">
+        ent_id = #{entId,jdbcType=INTEGER},
+      </if>
+      <if test="type != null">
+        type = #{type,jdbcType=INTEGER},
+      </if>
+      <if test="remark != null">
+        remark = #{remark,jdbcType=VARCHAR},
+      </if>
+      <if test="status != null">
+        status = #{status,jdbcType=INTEGER},
+      </if>
+      <if test="createBy != null">
+        create_by = #{createBy,jdbcType=BIGINT},
+      </if>
+      <if test="createTime != null">
+        create_time = #{createTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateBy != null">
+        update_by = #{updateBy,jdbcType=BIGINT},
+      </if>
+      <if test="updateTime != null">
+        update_time= #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="delFlag != null">
+        del_flag = #{delFlag,jdbcType=INTEGER},
+      </if>
+    </set>
+    where id = #{id,jdbcType=BIGINT}
+  </update>
+
     <insert id="saveBatch" parameterType="com.sckw.system.model.KwsEntType">
       insert into kws_ent_type
       <trim prefix="(" suffix=")" suffixOverrides=",">