Parcourir la source

多层关联列表查询sql修改

rgb il y a 6 ans
Parent
commit
d75c55c2f0

+ 15 - 15
knowledgeman-service/src/main/java/com/diagbot/dto/MultContactListDTO.java

@@ -16,30 +16,34 @@ import lombok.Setter;
 @Getter
 @Setter
 public class MultContactListDTO {
-	
-    
-    /**
-     * 概念id
+
+	/**
+     * 医学标准术语id
      */
-	@ApiModelProperty(value="概念id")
+	@ApiModelProperty(value="医学标准术语id")
     private Long conceptId;
     
     /**
-     * 医学标准术语
+     * 医学标准术语名称
      */
-	@ApiModelProperty(value="医学标准术语")
+	@ApiModelProperty(value="医学标准术语名称")
     private String libName;
     
     /**
-     * 术语类型
+     * 医学标准术语类型
      */
-	@ApiModelProperty(value="术语类型")
+	@ApiModelProperty(value="医学标准术语类型")
     private String libType;
+	
+	/**
+	 * 医学标准术语名称(医学标准术语类型)
+	 */
+	private String libNameType;
     
     /**
-     * 同义词
+     * 关联术语
      */
-	@ApiModelProperty(value="同义词")
+	@ApiModelProperty(value="关联术语")
     private String otherNames;
     
     /**
@@ -61,9 +65,5 @@ public class MultContactListDTO {
 	@ApiModelProperty(value="状态:Y-已删除,N-启用中")
 	private String isDeleted;
     
-    
-    
-    
-    
 
 }

+ 0 - 1
knowledgeman-service/src/main/java/com/diagbot/dto/RelationContactListDTO.java

@@ -16,7 +16,6 @@ import lombok.Setter;
 @Getter
 @Setter
 public class RelationContactListDTO {
-	
     
     /**
      * 医学标准术语id

+ 33 - 0
knowledgeman-service/src/main/resources/mapper/RelationMapper.xml

@@ -106,5 +106,38 @@
 		</if>
 		ORDER BY isDeleted ASC,operTime DESC
     </select>
+    
+    <select id="multContactList" resultType="com.diagbot.dto.MultContactListDTO">
+    	SELECT
+			*
+		FROM
+		(SELECT
+		t3.id AS conceptId,
+		t3.lib_name AS libName,
+		t4.name AS libType,
+		CONCAT(t3.lib_name,'(',t4.name,')') AS libNameType,
+		GROUP_CONCAT(t2.lib_name ORDER BY t1.gmt_modified DESC) AS otherNames,
+		t1.modifier AS operName,
+		MAX(t1.gmt_modified) AS operTime,
+		t1.is_deleted AS isDeleted
+		FROM
+		(SELECT
+		a.*
+		FROM
+		(SELECT * FROM kl_relation WHERE relation_id=17) a
+		JOIN kl_relation_order b ON a.id=b.t_relation_id
+		LEFT JOIN (SELECT * FROM kl_relation WHERE relation_id=17) c
+		ON a.end_id=c.start_id
+		WHERE c.id IS NULL) t1
+		JOIN kl_concept t2 ON t1.start_id=t2.id
+		JOIN kl_concept t3 ON t1.end_id=t3.id
+		JOIN kl_lexicon t4 ON t3.lib_type=t4.id
+		GROUP BY t3.id) tab
+		<if test="name!=null and name!=''">
+			and libNameType like concat('%',#{name},'%')
+		</if>
+		ORDER BY isDeleted ASC,operTime DESC
+    </select>
+    
 
 </mapper>