|
@@ -333,7 +333,168 @@
|
|
|
</if>)
|
|
|
<if test="detilType != null and detilType != ''">
|
|
|
UNION
|
|
|
- (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
|
|
|
+ (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType
|
|
|
+ <if test="isStatic != null and isStatic == 1">
|
|
|
+ ,t1.lib_type libTypeId
|
|
|
+ </if>
|
|
|
+ <if test="isStatic == null or isStatic != 1">
|
|
|
+ ,t5.lib_type libTypeId
|
|
|
+ </if> ,t6.`name` libTypeName FROM kl_concept t1
|
|
|
+ LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
|
|
|
+ LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
|
|
|
+ LEFT JOIN kl_concept t5 on t5.id = t4.start_id
|
|
|
+ LEFT JOIN kl_lexicon t6 ON
|
|
|
+ <if test="isStatic != null and isStatic == 1">
|
|
|
+ t6.id = t1.lib_type
|
|
|
+ </if>
|
|
|
+ <if test="isStatic == null or isStatic != 1">
|
|
|
+ t6.id = t5.lib_type
|
|
|
+ </if>
|
|
|
+ LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
|
|
|
+ WHERE
|
|
|
+ t1.is_deleted = 'N'
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ AND t4.is_deleted = 'N'
|
|
|
+ AND t5.is_deleted = 'N'
|
|
|
+ AND t6.is_deleted = 'N'
|
|
|
+ <if test="detilType != null">
|
|
|
+ AND t1.lib_type = #{detilType}
|
|
|
+ </if>
|
|
|
+ <if test="sexType == 3">
|
|
|
+ and t3.sex_type in ('1','2','3')
|
|
|
+ </if>
|
|
|
+ <if test="sexType != 3">
|
|
|
+ and t3.sex_type in ('3',#{sexType})
|
|
|
+ </if>
|
|
|
+ <if test="age != null and age != ''">
|
|
|
+ AND <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t3.max_age >= #{age} ]]>
|
|
|
+ </if>
|
|
|
+ AND (t2.spell = UPPER(#{InputStr}) OR t2.name = #{InputStr})
|
|
|
+ <if test="inputIds != null and inputIds.size > 0">
|
|
|
+ and t1.id not in
|
|
|
+ <foreach item="id" collection="inputIds" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ AND t4.relation_id = 18
|
|
|
+ <if test="isStatic != null and isStatic == 1">
|
|
|
+ GROUP BY t5.id
|
|
|
+ </if>
|
|
|
+ <if test="isStatic == null or isStatic != 1">
|
|
|
+ LIMIT 100
|
|
|
+ </if>)
|
|
|
+ UNION
|
|
|
+ (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType
|
|
|
+ <if test="isStatic != null and isStatic == 1">
|
|
|
+ ,t1.lib_type libTypeId
|
|
|
+ </if>
|
|
|
+ <if test="isStatic == null or isStatic != 1">
|
|
|
+ ,t5.lib_type libTypeId
|
|
|
+ </if> ,t6.`name` libTypeName FROM kl_concept t1
|
|
|
+ LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
|
|
|
+ LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
|
|
|
+ LEFT JOIN kl_concept t5 on t5.id = t4.start_id
|
|
|
+ LEFT JOIN kl_lexicon t6 ON
|
|
|
+ <if test="isStatic != null and isStatic == 1">
|
|
|
+ t6.id = t1.lib_type
|
|
|
+ </if>
|
|
|
+ <if test="isStatic == null or isStatic != 1">
|
|
|
+ t6.id = t5.lib_type
|
|
|
+ </if>
|
|
|
+ LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
|
|
|
+ WHERE
|
|
|
+ t1.is_deleted = 'N'
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ AND t4.is_deleted = 'N'
|
|
|
+ AND t5.is_deleted = 'N'
|
|
|
+ AND t6.is_deleted = 'N'
|
|
|
+ <if test="detilType != null">
|
|
|
+ AND t1.lib_type = #{detilType}
|
|
|
+ </if>
|
|
|
+ <if test="sexType == 3">
|
|
|
+ and t3.sex_type in ('1','2','3')
|
|
|
+ </if>
|
|
|
+ <if test="sexType != 3">
|
|
|
+ and t3.sex_type in ('3',#{sexType})
|
|
|
+ </if>
|
|
|
+ <if test="age != null and age != ''">
|
|
|
+ AND <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t3.max_age >= #{age} ]]>
|
|
|
+ </if>
|
|
|
+ AND (t2.spell LIKE CONCAT(UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT( #{InputStr},'%'))
|
|
|
+ <if test="inputIds != null and inputIds.size > 0">
|
|
|
+ and t1.id not in
|
|
|
+ <foreach item="id" collection="inputIds" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ AND t4.relation_id = 18
|
|
|
+ <if test="isStatic != null and isStatic == 1">
|
|
|
+ GROUP BY t5.id
|
|
|
+ </if>
|
|
|
+ <if test="isStatic == null or isStatic != 1">
|
|
|
+ LIMIT 100
|
|
|
+ </if>)
|
|
|
+ UNION
|
|
|
+ (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType
|
|
|
+ <if test="isStatic != null and isStatic == 1">
|
|
|
+ ,t1.lib_type libTypeId
|
|
|
+ </if>
|
|
|
+ <if test="isStatic == null or isStatic != 1">
|
|
|
+ ,t5.lib_type libTypeId
|
|
|
+ </if> ,t6.`name` libTypeName FROM kl_concept t1
|
|
|
+ LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
|
|
|
+ LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
|
|
|
+ LEFT JOIN kl_concept t5 on t5.id = t4.start_id
|
|
|
+ LEFT JOIN kl_lexicon t6 ON
|
|
|
+ <if test="isStatic != null and isStatic == 1">
|
|
|
+ t6.id = t1.lib_type
|
|
|
+ </if>
|
|
|
+ <if test="isStatic == null or isStatic != 1">
|
|
|
+ t6.id = t5.lib_type
|
|
|
+ </if>
|
|
|
+ LEFT JOIN kl_concept_common t3 ON t5.id = t3.concept_id
|
|
|
+ WHERE
|
|
|
+ t1.is_deleted = 'N'
|
|
|
+ AND t2.is_deleted = 'N'
|
|
|
+ AND t3.is_deleted = 'N'
|
|
|
+ AND t4.is_deleted = 'N'
|
|
|
+ AND t5.is_deleted = 'N'
|
|
|
+ AND t6.is_deleted = 'N'
|
|
|
+ <if test="detilType != null">
|
|
|
+ AND t1.lib_type = #{detilType}
|
|
|
+ </if>
|
|
|
+ <if test="sexType == 3">
|
|
|
+ and t3.sex_type in ('1','2','3')
|
|
|
+ </if>
|
|
|
+ <if test="sexType != 3">
|
|
|
+ and t3.sex_type in ('3',#{sexType})
|
|
|
+ </if>
|
|
|
+ <if test="age != null and age != ''">
|
|
|
+ AND <![CDATA[ t3.min_age <= #{age} ]]>
|
|
|
+ AND <![CDATA[ t3.max_age >= #{age} ]]>
|
|
|
+ </if>
|
|
|
+ AND (t2.spell LIKE CONCAT('%',UPPER(#{InputStr}),'%') OR t2.name LIKE CONCAT('%',#{InputStr},'%'))
|
|
|
+ <if test="inputIds != null and inputIds.size > 0">
|
|
|
+ and t1.id not in
|
|
|
+ <foreach item="id" collection="inputIds" open="(" separator="," close=")">
|
|
|
+ #{id}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ AND t4.relation_id = 18
|
|
|
+ <if test="isStatic != null and isStatic == 1">
|
|
|
+ GROUP BY t5.id
|
|
|
+ </if>
|
|
|
+ <if test="isStatic == null or isStatic != 1">
|
|
|
+ LIMIT 100
|
|
|
+ </if>)
|
|
|
+ </if>
|
|
|
+ <if test="isStatic != null and isStatic == 1">
|
|
|
+ UNION
|
|
|
+ (SELECT 0 selfId,null selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
|
|
|
LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
|
|
|
LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
|
|
|
LEFT JOIN kl_concept t5 on t5.id = t4.start_id
|
|
@@ -374,7 +535,7 @@
|
|
|
LIMIT 100
|
|
|
</if>)
|
|
|
UNION
|
|
|
- (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
|
|
|
+ (SELECT 0 selfId,null selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
|
|
|
LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
|
|
|
LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
|
|
|
LEFT JOIN kl_concept t5 on t5.id = t4.start_id
|
|
@@ -415,7 +576,7 @@
|
|
|
LIMIT 100
|
|
|
</if>)
|
|
|
UNION
|
|
|
- (SELECT t1.id selfId,t1.lib_name selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
|
|
|
+ (SELECT 0 selfId,null selfName,t5.id parentId,t5.lib_name parentName,null sameName,t2.is_concept showType,t5.lib_type libTypeId,t6.`name` libTypeName FROM kl_concept t1
|
|
|
LEFT JOIN kl_library_info t2 ON t1.id = t2.concept_id
|
|
|
LEFT JOIN kl_relation t4 ON t4.end_id= t1.id
|
|
|
LEFT JOIN kl_concept t5 on t5.id = t4.start_id
|