Prechádzať zdrojové kódy

1、静态知识维护增加启用禁用标志

zhaops 4 rokov pred
rodič
commit
67f0f0eb72

+ 1 - 1
src/main/java/com/diagbot/dto/ConceptInfoDTO.java

@@ -53,7 +53,7 @@ public class ConceptInfoDTO {
     /**
      * 启用状态
      */
-    private String isDeleted;
+    private Integer status;
     /**
      * 明细
      */

+ 14 - 0
src/main/java/com/diagbot/entity/ConceptInfo.java

@@ -71,6 +71,11 @@ public class ConceptInfo implements Serializable {
      */
     private String noticeName;
 
+    /**
+     * 启用状态(0:禁用,1:启用)
+     */
+    private Integer status;
+
     public Long getId() {
         return id;
     }
@@ -151,6 +156,14 @@ public class ConceptInfo implements Serializable {
         this.noticeName = noticeName;
     }
 
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
     @Override
     public String toString() {
         return "ConceptInfo{" +
@@ -164,6 +177,7 @@ public class ConceptInfo implements Serializable {
                 ", type=" + type +
                 ", clinicalPathwayName=" + clinicalPathwayName +
                 ", noticeName=" + noticeName +
+                ", status=" + status +
                 "}";
     }
 }

+ 22 - 8
src/main/java/com/diagbot/facade/ConceptInfoFacade.java

@@ -15,6 +15,7 @@ import com.diagbot.entity.ConceptDetail;
 import com.diagbot.entity.ConceptInfo;
 import com.diagbot.enums.IsDeleteEnum;
 import com.diagbot.enums.StaticTypeEnum;
+import com.diagbot.enums.StatusEnum;
 import com.diagbot.exception.CommonErrorCode;
 import com.diagbot.exception.CommonException;
 import com.diagbot.service.ConceptDetailService;
@@ -146,6 +147,9 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
             QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
             conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
             conceptInfoQueryWrapper.in("name", conNameList);
+            if (type.equals(0)) {
+                conceptInfoQueryWrapper.eq("status", StatusEnum.Enable.getKey());
+            }
             List<ConceptInfo> conceptInfoList = this.list(conceptInfoQueryWrapper);
             if (ListUtil.isNotEmpty(conceptInfoList)) {
                 //typeName转换
@@ -164,9 +168,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
                         .collect(Collectors.toList());
                 if (ListUtil.isNotEmpty(conceptIdList)) {
                     QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
-                    if (type.equals(0)) {
-                        conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
-                    }
+                    conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
                     conceptDetailQueryWrapper.in("concept_id", conceptIdList);
                     List<ConceptDetail> conceptDetailList = conceptDetailFacade.list(conceptDetailQueryWrapper);
                     Map<Long, List<ConceptDetail>> detailMap
@@ -236,6 +238,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
         conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .eq("name", staticKnowledgeVO.getName())
+                .eq("status", StatusEnum.Enable.getKey())
                 .eq("type", typeName);
         ConceptInfo conceptInfo = this.getOne(conceptInfoQueryWrapper, false);
 
@@ -339,6 +342,7 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         QueryWrapper<ConceptInfo> conceptInfoQueryWrapper = new QueryWrapper<>();
         conceptInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
                 .in("name", uniqueNameList)
+                .eq("status",StatusEnum.Enable.getKey())
                 .eq("type", typeName);
         List<ConceptInfo> conceptInfoList = this.list(conceptInfoQueryWrapper);
 
@@ -585,11 +589,12 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
         conceptInfo.setModifier(userId);
         conceptInfo.setGmtModified(now);
 
-        //是否包含静态信息,包含启用和禁用
+        //是否包含静态信息
         List<ConceptDetail> oldDetails = null;
         QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
         if (conceptInfo.getId() != null) {
             conceptDetailQueryWrapper.eq("concept_id", conceptInfo.getId());
+            conceptDetailQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
             oldDetails = conceptDetailFacade.list(conceptDetailQueryWrapper);
         }
         if (conceptInfoVO.getId() == null
@@ -645,11 +650,20 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
     public Boolean changeStatus(ChangeStatusVO changeStatusVO) {
         String userId = SysUserUtils.getCurrentPrincipleID();
         Date now = DateUtil.now();
+        //更新主表
+        UpdateWrapper<ConceptInfo> conceptInfoUpdateWrapper = new UpdateWrapper<>();
+        conceptInfoUpdateWrapper.eq("id", changeStatusVO.getId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
+                .set("gmt_modified", now)
+                .set("modifier", userId)
+                .set("status", changeStatusVO.getStatus());
+        this.update(conceptInfoUpdateWrapper);
+        //更新明细表
         UpdateWrapper<ConceptDetail> conceptDetailUpdateWrapper = new UpdateWrapper<>();
         conceptDetailUpdateWrapper.eq("concept_id", changeStatusVO.getId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey())
                 .set("gmt_modified", now)
-                .set("modifier", userId)
-                .set("is_deleted", changeStatusVO.getIsDeleted());
+                .set("modifier", userId);
         conceptDetailService.update(conceptDetailUpdateWrapper);
         return true;
     }
@@ -674,7 +688,8 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
             return false;
         }
         QueryWrapper<ConceptDetail> conceptDetailQueryWrapper = new QueryWrapper<>();
-        conceptDetailQueryWrapper.eq("concept_id", conceptInfo.getId());
+        conceptDetailQueryWrapper.eq("concept_id", conceptInfo.getId())
+                .eq("is_deleted", IsDeleteEnum.N.getKey());
         List<ConceptDetail> conceptDetailList = conceptDetailService.list(conceptDetailQueryWrapper);
         if (ListUtil.isEmpty(conceptDetailList)) {
             return false;
@@ -710,7 +725,6 @@ public class ConceptInfoFacade extends ConceptInfoServiceImpl {
             conceptInfoDTO.setType(String.valueOf(StaticTypeEnum.getKey(typeName)));
             conceptInfoDTO.setModifier(conceptDetailList.get(0).getModifier());
             conceptInfoDTO.setGmtModified(conceptDetailList.get(0).getGmtModified());
-            conceptInfoDTO.setIsDeleted(conceptDetailList.get(0).getIsDeleted());
         }
         return conceptInfoDTO;
     }

+ 1 - 1
src/main/java/com/diagbot/vo/ChangeStatusVO.java

@@ -12,5 +12,5 @@ import lombok.Setter;
 @Setter
 public class ChangeStatusVO {
     private Long id;
-    private String isDeleted;
+    private Integer status;
 }

+ 1 - 1
src/main/java/com/diagbot/vo/ConceptInfoPageVO.java

@@ -29,5 +29,5 @@ public class ConceptInfoPageVO extends Page {
     /**
      * 启用状态
      */
-    private String isDeleted;
+    private Integer status;
 }

+ 10 - 8
src/main/resources/mapper/ConceptInfoMapper.xml

@@ -24,7 +24,7 @@
         t1.clinicalPathwayName,
         t1.noticeName,
         t1.type,
-        t1.isDeleted,
+        t1.status,
         t1.title,
         t1.gmtModified,
         t2.linkman AS modifier
@@ -36,17 +36,19 @@
         a.clinical_pathway_name AS clinicalPathwayName,
         a.notice_name AS noticeName,
         a.type,
-        b.is_deleted AS isDeleted,
-        GROUP_CONCAT( b.title ORDER BY order_no asc SEPARATOR '、' ) AS title,
-        b.gmt_modified AS gmtModified,
-        b.modifier
+        a.status,
+        GROUP_CONCAT( b.title order by b.order_no asc SEPARATOR '、' ) AS title,
+        a.gmt_modified AS gmtModified,
+        a.modifier
         FROM
         graph_concept_info a,
         graph_concept_detail b
         WHERE
         a.id = b.concept_id
-        <if test="conceptInfoPageVO.isDeleted!=null and conceptInfoPageVO.isDeleted!=''">
-            AND b.is_deleted = #{conceptInfoPageVO.isDeleted}
+        and a.is_deleted = 'N'
+        and b.is_deleted = 'N'
+        <if test="conceptInfoPageVO.status!=null and conceptInfoPageVO.status!=''">
+            AND a.status = #{conceptInfoPageVO.status}
         </if>
         <if test="conceptInfoPageVO.name!=null and conceptInfoPageVO.name!=''">
             AND a.name like concat('%', #{conceptInfoPageVO.name},'%')
@@ -59,7 +61,7 @@
         ) t1
         LEFT JOIN sys_user t2 ON t1.modifier = t2.id
         ORDER BY
-        t1.isDeleted ASC,
+        t1.status ASC,
         t1.gmtModified DESC
     </select>