|
@@ -143,7 +143,7 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="onlyByRootList" resultType="com.diagbot.dto.OnlyByRootListDTO">
|
|
|
- SELECT
|
|
|
+ <!--SELECT
|
|
|
c.id AS conceptId,
|
|
|
c.lib_name AS libName,
|
|
|
c.lib_type AS libTypeId,
|
|
@@ -171,7 +171,51 @@
|
|
|
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
|
|
|
+ ORDER BY operTime DESC-->
|
|
|
+ SELECT
|
|
|
+ t2.id AS conceptId,
|
|
|
+ t2.lib_name AS libName,
|
|
|
+ t2.lib_type AS libTypeId,
|
|
|
+ GROUP_CONCAT(t3.lib_name ORDER BY t1.order_no ASC) AS otherNames,
|
|
|
+ t1.modifier AS operName,
|
|
|
+ t1.gmt_modified AS operTime,
|
|
|
+ t1.is_deleted AS isDeleted
|
|
|
+ FROM
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ a.*,c.order_no
|
|
|
+ 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 kl_relation_order c ON a.id=c.t_relation_id
|
|
|
+ WHERE b.end_id IS NULL
|
|
|
+ ) t1
|
|
|
+ <if test="isOnlyHasRoot==1">
|
|
|
+ RIGHT
|
|
|
+ </if>
|
|
|
+ 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>
|
|
|
+ <if test="name!=null and name!=''">
|
|
|
+ AND lib_name LIKE CONCAT("%",#{name},"%")
|
|
|
+ </if>
|
|
|
+ ) t2
|
|
|
+ ON t1.start_id=t2.id
|
|
|
+ <if test="isOnlyHasRoot==1">
|
|
|
+ LEFT
|
|
|
+ </if>
|
|
|
+ JOIN
|
|
|
+ kl_concept t3 ON t1.end_id=t3.id
|
|
|
+ GROUP BY t2.id
|
|
|
+ ORDER BY t1.gmt_modified DESC,t2.id DESC
|
|
|
</select>
|
|
|
|
|
|
|