Explorar el Código

多层关系列表修改

rgb hace 6 años
padre
commit
ace1319d1d
Se han modificado 1 ficheros con 12 adiciones y 13 borrados
  1. 12 13
      knowledgeman-service/src/main/resources/mapper/RelationMapper.xml

+ 12 - 13
knowledgeman-service/src/main/resources/mapper/RelationMapper.xml

@@ -150,15 +150,13 @@
     </select> -->
     
     <select id="multContactList" resultType="com.diagbot.dto.MultContactListDTO">
-    	SELECT
-		t1.start_id AS conceptId,
-		t1.modifier AS operName,
-		t1.gmt_modified AS operTime,
-		t1.is_deleted AS isDeleted,
-		GROUP_CONCAT(t1.end_id ORDER BY t2.order_no ASC) AS otherIds
-		FROM
-		(SELECT 
-		DISTINCT a.*
+    	SELECT 
+		a.start_id AS conceptId,
+		a.modifier AS operName,
+		a.gmt_modified AS operTime,
+		a.is_deleted AS isDeleted,
+		GROUP_CONCAT(a.end_id ORDER BY d.order_no ASC) AS otherIds,
+		SUM(CASE WHEN b.start_id IS NULL THEN 0 ELSE 1 END) AS notnullcou
 		FROM
 		(SELECT * FROM kl_relation WHERE relation_id=17
 		<choose>
@@ -174,11 +172,12 @@
 			</otherwise>
 		</choose>
 		) a
-		JOIN (SELECT start_id FROM kl_relation WHERE relation_id=17) b ON a.end_id=b.start_id
+		LEFT JOIN (SELECT start_id FROM kl_relation WHERE relation_id=17) b ON a.end_id=b.start_id
 		LEFT JOIN (SELECT end_id FROM kl_relation WHERE relation_id=17) c ON a.start_id=c.end_id
-		WHERE c.end_id IS NULL) t1
-		LEFT JOIN kl_relation_order t2 ON t1.id=t2.t_relation_id
-		GROUP BY start_id
+		LEFT JOIN kl_relation_order d ON a.id=d.t_relation_id
+		WHERE c.end_id IS NULL 
+		GROUP BY a.start_id
+		HAVING notnullcou>0
 		ORDER BY operTime DESC
     </select>