|
@@ -2,51 +2,69 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.diagbot.mapper.DisScaleMapper">
|
|
|
|
|
|
- <select id="indexScale" resultType="com.diagbot.dto.ConceptBaseDTO">
|
|
|
- SELECT DISTINCT concept_id,name
|
|
|
+ <select id="indexScale" resultType="com.diagbot.dto.ScaleIndexDTO">
|
|
|
+ SELECT concept_id,name,search_name,show_type, from_dis
|
|
|
FROM
|
|
|
(
|
|
|
+
|
|
|
+ (
|
|
|
+ SELECT a.name search_name,b.id concept_id,b.lib_name name,a.is_concept as show_type, 0 as from_dis
|
|
|
+ FROM `kl_library_info` a, kl_concept b
|
|
|
+ where a.is_deleted = 'N' and b.is_deleted = 'N' and a.concept_id = b.id
|
|
|
+ and a.`name` = #{name}
|
|
|
+ and b.lib_type = #{endType}
|
|
|
+ )
|
|
|
+ union
|
|
|
(
|
|
|
- SELECT
|
|
|
- t3.id AS concept_id,
|
|
|
- t3.lib_name AS name
|
|
|
- FROM
|
|
|
- `kl_concept` t1,
|
|
|
- `kl_relation` t2,
|
|
|
- `kl_concept` t3,
|
|
|
- `kl_relation_order` t4
|
|
|
- WHERE
|
|
|
- t1.is_deleted = 'N'
|
|
|
- AND t2.is_deleted = 'N'
|
|
|
- AND t3.is_deleted = 'N'
|
|
|
- AND t4.is_deleted = 'N'
|
|
|
- AND t1.id = t2.start_id
|
|
|
- AND t3.id = t2.end_id
|
|
|
- AND t2.id = t4.t_relation_id
|
|
|
- <if test="name != null and name != ''">
|
|
|
- AND t1.lib_name LIKE concat ('%',#{name},'%')
|
|
|
- </if>
|
|
|
- <if test="startType != null">
|
|
|
- AND t1.lib_type = #{startType}
|
|
|
- </if>
|
|
|
- <if test="relationType != null">
|
|
|
- AND t2.relation_id = #{relationType}
|
|
|
- </if>
|
|
|
- <if test="endType != null">
|
|
|
- AND t3.lib_type = #{endType}
|
|
|
- </if>
|
|
|
+ SELECT a.name search_name,b.id concept_id,b.lib_name name,a.is_concept as show_type, 0 as from_dis
|
|
|
+ FROM `kl_library_info` a, kl_concept b
|
|
|
+ where a.is_deleted = 'N' and b.is_deleted = 'N' and a.concept_id = b.id
|
|
|
+ and a.`name` like concat (#{name},'%')
|
|
|
+ and b.lib_type = #{endType}
|
|
|
)
|
|
|
- UNION
|
|
|
+ union
|
|
|
(
|
|
|
- SELECT
|
|
|
- c.id AS concept_id,
|
|
|
- c.lib_name AS name
|
|
|
- FROM
|
|
|
- kl_concept c
|
|
|
- WHERE
|
|
|
- c.lib_name LIKE concat ('%',#{name},'%')
|
|
|
- AND c.lib_type = #{endType}
|
|
|
+ SELECT a.name search_name,b.id concept_id,b.lib_name name,a.is_concept as show_type, 0 as from_dis
|
|
|
+ FROM `kl_library_info` a, kl_concept b
|
|
|
+ where a.is_deleted = 'N' and b.is_deleted = 'N' and a.concept_id = b.id
|
|
|
+ and a.`name` like concat ('%',#{name},'%')
|
|
|
+ and b.lib_type = #{endType}
|
|
|
)
|
|
|
+
|
|
|
+ <if test="disName != null and disName.size() > 0">
|
|
|
+ union
|
|
|
+ (
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ t1.lib_name search_name,
|
|
|
+ t3.id AS concept_id,
|
|
|
+ t3.lib_name AS name,
|
|
|
+ 0 as show_type,
|
|
|
+ 1 as from_dis
|
|
|
+ FROM
|
|
|
+ `kl_concept` t1,
|
|
|
+ `kl_relation` t2,
|
|
|
+ `kl_concept` t3
|
|
|
+ WHERE
|
|
|
+ t1.is_deleted = 'N'
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ AND t1.id = t2.start_id
|
|
|
+ AND t3.id = t2.end_id
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND t1.lib_name LIKE concat ('%',#{name},'%')
|
|
|
+ </if>
|
|
|
+ <if test="startType != null">
|
|
|
+ AND t1.lib_type = #{startType}
|
|
|
+ </if>
|
|
|
+ <if test="relationType != null">
|
|
|
+ AND t2.relation_id = #{relationType}
|
|
|
+ </if>
|
|
|
+ <if test="endType != null">
|
|
|
+ AND t3.lib_type = #{endType}
|
|
|
+ </if>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
) s
|
|
|
where 1 = 1
|
|
|
<if test="filterName != null and filterName.size > 0">
|