3 Commits 4a3a22dd4a ... a2bce48a24

Autor SHA1 Mensaje Fecha
  lin.liu a2bce48a24 Merge branch 'master' into dev hace 3 semanas
  lin.liu 41708a3a33 mybatis plus,逻辑删除字段配置 hace 3 semanas
  lin.liu 69d569634b 检查表 hace 3 semanas

+ 5 - 3
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/mapper/impl/DangerCheckItemMapperImpl.java

@@ -1,6 +1,7 @@
 package com.customs.cq.datacenter.business.mapper.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.customs.cq.datacenter.common.enums.EOrderBy;
@@ -101,9 +102,10 @@ public class DangerCheckItemMapperImpl extends BasicMapper<DangerCheckItemPO> {
     }
 
     public int removeByCheckForm(Long formId) {
-        LambdaQueryWrapper<DangerCheckItemPO> where = this.getQuery();
-        where.eq(DangerCheckItemPO::getCheckFormId, formId);
-        return mapper.delete(where);
+        UpdateWrapper<DangerCheckItemPO> update = this.getUpdate();
+        update.set("IS_DELETE", EYesOrNo.YES.getValue());
+        update.eq("CHECK_FORM_ID", formId);
+        return mapper.update(null, update);
     }
 
     public List<DangerCheckItemPO> list4CheckForm(Long formId) {

+ 38 - 35
secure-producting-business/src/main/java/com/customs/cq/datacenter/business/service/DangerCheckFormService.java

@@ -156,46 +156,49 @@ public class DangerCheckFormService extends BasicService {
             DangerCategoryPO dangerCategory = dangerCategoryService.check4IdExc(find.getDangerCategory());
 
             result = CopierUtil.mapTo(find, DangerCheckFormVO.class);
-            result.setListItem(CopierUtil.mapTo(listItem, ReqCreateDangerCheckItem.class));
+            result.setListItem(new ArrayList<>());
+            if (ListUtil.isNotNullOrEmpty(listItem)) {
+                result.setListItem(CopierUtil.mapTo(listItem, ReqCreateDangerCheckItem.class));
+            }
             result.setDangerCategoryTxt(dangerCategory.getCategoryName());
         }
         return ExecutedResult.success(result);
     }
 
-//    public ExecutedResult<String> stop(Long id) {
-//        // 验证记录是否存在
-//        ExecutedResult<DangerCheckFormPO> checkExists = this.check4Id(id);
-//        if (checkExists.isFailed()) {
-//            return ExecutedResult.failed(checkExists.getMsg());
-//        }
-//        DangerCheckFormPO item = new DangerCheckFormPO();
-//        item.setId(id);
-//        item.setStatus(EState.DISABLED.getValue());
-//
-//       int result = this.dao.updateById(item);
-//       if (result != 1) {
-//           return ExecutedResult.failed("停用[隐患检查表]失败。");
-//       }
-//       return ExecutedResult.success();
-//   }
-//
-//    public ExecutedResult<String> enable(Long id) {
-//        // 验证记录是否存在
-//        ExecutedResult<DangerCheckFormPO> checkExists = this.check4Id(id);
-//        if (checkExists.isFailed()) {
-//            return ExecutedResult.failed(checkExists.getMsg());
-//        }
-//        DangerCheckFormPO item = new DangerCheckFormPO();
-//        item.setId(id);
-//        item.setStatus(EState.NORMAL.getValue());
-//
-//        int result = this.dao.updateById(item);
-//        if (result != 1) {
-//            return ExecutedResult.failed("启用[隐患检查表]失败。");
-//        }
-//        return ExecutedResult.success();
-//    }
-//
+    public ExecutedResult<String> stop(Long id) {
+        // 验证记录是否存在
+        ExecutedResult<DangerCheckFormPO> checkExists = this.check4Id(id);
+        if (checkExists.isFailed()) {
+            return ExecutedResult.failed(checkExists.getMsg());
+        }
+        DangerCheckFormPO item = new DangerCheckFormPO();
+        item.setId(id);
+        item.setStatus(EState.DISABLED.getValue());
+
+       int result = this.dao.updateById(item);
+       if (result != 1) {
+           return ExecutedResult.failed("停用[隐患检查表]失败。");
+       }
+       return ExecutedResult.success();
+   }
+
+    public ExecutedResult<String> enable(Long id) {
+        // 验证记录是否存在
+        ExecutedResult<DangerCheckFormPO> checkExists = this.check4Id(id);
+        if (checkExists.isFailed()) {
+            return ExecutedResult.failed(checkExists.getMsg());
+        }
+        DangerCheckFormPO item = new DangerCheckFormPO();
+        item.setId(id);
+        item.setStatus(EState.NORMAL.getValue());
+
+        int result = this.dao.updateById(item);
+        if (result != 1) {
+            return ExecutedResult.failed("启用[隐患检查表]失败。");
+        }
+        return ExecutedResult.success();
+    }
+
 //    public ExecutedResult<String> setSort(ReqSetSort request) {
 //        // 验证记录是否存在
 //        ExecutedResult<DangerCheckFormPO> checkExists = this.check4Id(request.getId());

+ 4 - 5
secure-producting-host/src/main/resources/application.yml

@@ -173,14 +173,13 @@ mybatis-plus:
   global-config:
     # 是否打印 Logo banner
     banner: true
-    dbConfig:
+    db-config:
       # 主键类型
       # AUTO 自增 NONE 空 INPUT 用户输入 ASSIGN_ID 雪花 ASSIGN_UUID 唯一 UUID
       idType: ASSIGN_ID
-      # 逻辑已删除值
-      logicDeleteValue: 2
-      # 逻辑未删除值
-      logicNotDeleteValue: 0
+      logic-delete-field: is_delete # 逻辑删除字段名
+      logic-delete-value: 1 # 逻辑已删除值
+      logic-not-delete-value: 0 # 逻辑未删除值
       # 字段验证策略之 insert,在 insert 的时候的字段验证策略
       # IGNORED 忽略 NOT_NULL 非NULL NOT_EMPTY 非空 DEFAULT 默认 NEVER 不加入 SQL
       insertStrategy: NOT_NULL