|
@@ -113,41 +113,6 @@
|
|
|
ORDER BY isDeleted ASC,operTime DESC
|
|
|
</select>
|
|
|
|
|
|
- <!-- <select id="multContactList" resultType="com.diagbot.dto.MultContactListDTO">
|
|
|
- SELECT
|
|
|
- *
|
|
|
- FROM
|
|
|
- (SELECT
|
|
|
- t2.id AS conceptId,
|
|
|
- t2.lib_name AS libName,
|
|
|
- t4.name AS libType,
|
|
|
- CONCAT(t2.lib_name,'(',t4.name,')') AS libNameType,
|
|
|
- GROUP_CONCAT(t3.lib_name ORDER BY t5.order_no ASC,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.start_id=c.end_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 t2.lib_type=t4.id
|
|
|
- LEFT JOIN kl_relation_order t5 ON t1.id=t5.t_relation_id
|
|
|
- where t2.is_deleted='N' AND t3.is_deleted='N' AND t4.is_deleted='N'
|
|
|
- GROUP BY t2.id) tab
|
|
|
- where 1=1
|
|
|
- <if test="name!=null and name!=''">
|
|
|
- and libNameType like concat('%',#{name},'%')
|
|
|
- </if>
|
|
|
- ORDER BY isDeleted ASC,operTime DESC
|
|
|
- </select> -->
|
|
|
-
|
|
|
<select id="multContactList" resultType="com.diagbot.dto.MultContactListDTO">
|
|
|
SELECT
|
|
|
a.start_id AS conceptId,
|
|
@@ -208,5 +173,65 @@
|
|
|
ORDER BY isDeleted ASC,operTime DESC
|
|
|
</select>
|
|
|
|
|
|
+ <select id="singleRelationList" resultType="com.diagbot.dto.SingleRelationListDTO">
|
|
|
+ SELECT
|
|
|
+ d.id AS conceptId,
|
|
|
+ d.lib_name AS libName,
|
|
|
+ d.lib_type AS libTypeId,
|
|
|
+ CONCAT(d.lib_type,"-",e.lib_type) AS relationModelTypeCode,
|
|
|
+ GROUP_CONCAT(e.lib_name ORDER BY f.order_no ASC) AS otherNames,
|
|
|
+ a.modifier AS operName,
|
|
|
+ a.gmt_modified AS operTime,
|
|
|
+ a.is_deleted AS isDeleted
|
|
|
+ FROM
|
|
|
+ (SELECT id,is_deleted,gmt_modified,modifier,start_id,end_id FROM kl_relation WHERE relation_id=#{relationId} AND is_deleted='N') a
|
|
|
+ LEFT JOIN
|
|
|
+ (SELECT end_id FROM kl_relation WHERE relation_id=#{relationId} AND is_deleted='N') b
|
|
|
+ ON a.start_id=b.end_id
|
|
|
+ LEFT JOIN
|
|
|
+ (SELECT start_id FROM kl_relation WHERE relation_id=#{relationId} AND is_deleted='N') c
|
|
|
+ ON a.end_id=c.start_id
|
|
|
+ JOIN
|
|
|
+ (SELECT id,lib_name,lib_type FROM kl_concept WHERE is_deleted='N' AND lib_type=#{startTypeId} AND lib_name LIKE CONCAT("%",#{name},"%")) d
|
|
|
+ ON a.start_id=d.id
|
|
|
+ JOIN
|
|
|
+ (SELECT id,lib_name,lib_type FROM kl_concept WHERE is_deleted='N' AND lib_type=#{endTypeId}) e
|
|
|
+ ON a.end_id=e.id
|
|
|
+ LEFT JOIN kl_relation_order f ON a.id=f.t_relation_id
|
|
|
+ WHERE b.end_id IS NULL AND c.start_id IS NULL
|
|
|
+ GROUP BY d.id
|
|
|
+ ORDER BY operTime DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="onlyByRootList" resultType="com.diagbot.dto.OnlyByRootListDTO">
|
|
|
+ SELECT
|
|
|
+ c.id AS conceptId,
|
|
|
+ c.lib_name AS libName,
|
|
|
+ c.lib_type AS libTypeId,
|
|
|
+ GROUP_CONCAT(d.lib_name ORDER BY e.order_no ASC) AS otherNames,
|
|
|
+ a.modifier AS operName,
|
|
|
+ a.gmt_modified AS operTime,
|
|
|
+ a.is_deleted AS isDeleted
|
|
|
+ FROM
|
|
|
+ (SELECT id,is_deleted,gmt_modified,modifier,start_id,end_id FROM kl_relation WHERE relation_id=#{relationId} AND is_deleted='N') a
|
|
|
+ LEFT JOIN
|
|
|
+ (SELECT end_id FROM kl_relation WHERE relation_id=#{relationId} AND is_deleted='N') b
|
|
|
+ ON a.start_id=b.end_id
|
|
|
+ JOIN
|
|
|
+ (SELECT id,lib_name,lib_type FROM kl_concept WHERE is_deleted='N'
|
|
|
+ AND lib_type in
|
|
|
+ <foreach collection="startTypeIds" open="(" close=")" separator="," item="startTypeId">
|
|
|
+ #{startTypeId}
|
|
|
+ </foreach>
|
|
|
+ AND lib_name LIKE CONCAT("%",#{name},"%")) c
|
|
|
+ ON a.start_id=c.id
|
|
|
+ JOIN kl_concept d ON a.end_id=d.id
|
|
|
+ LEFT JOIN kl_relation_order e ON a.id=e.t_relation_id
|
|
|
+ WHERE b.end_id IS NULL
|
|
|
+ GROUP BY c.id
|
|
|
+ ORDER BY operTime DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
|
|
|
</mapper>
|