|
@@ -25,48 +25,10 @@
|
|
|
`kl_concept` t1,
|
|
|
`kl_relation` t2,
|
|
|
<if test="startSex != null or startAge != null">
|
|
|
- (
|
|
|
- SELECT
|
|
|
- concept_id
|
|
|
- FROM
|
|
|
- kl_concept_common
|
|
|
- WHERE
|
|
|
- is_deleted = 'N'
|
|
|
- <if test="startSex != null">
|
|
|
- <if test="startSex == 3">
|
|
|
- and sex_type in ('1','2','3')
|
|
|
- </if>
|
|
|
- <if test="startSex != 3">
|
|
|
- and sex_type in ('3',#{startSex})
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="startAge != null">
|
|
|
- <![CDATA[ AND min_age <= #{startAge} ]]>
|
|
|
- <![CDATA[ AND max_age >= #{startAge} ]]>
|
|
|
- </if>
|
|
|
- ) c1,
|
|
|
+ kl_concept_common c1,
|
|
|
</if>
|
|
|
<if test="endSex != null or endAge != null">
|
|
|
- (
|
|
|
- SELECT
|
|
|
- concept_id
|
|
|
- FROM
|
|
|
- kl_concept_common
|
|
|
- WHERE
|
|
|
- is_deleted = 'N'
|
|
|
- <if test="endSex != null">
|
|
|
- <if test="endSex == 3">
|
|
|
- and sex_type in ('1','2','3')
|
|
|
- </if>
|
|
|
- <if test="endSex != 3">
|
|
|
- and sex_type in ('3',#{endSex})
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="endAge != null">
|
|
|
- <![CDATA[ AND min_age <= #{endAge} ]]>
|
|
|
- <![CDATA[ AND max_age >= #{endAge} ]]>
|
|
|
- </if>
|
|
|
- ) c2,
|
|
|
+ kl_concept_common c2,
|
|
|
</if>
|
|
|
`kl_concept` t3
|
|
|
WHERE
|
|
@@ -82,6 +44,19 @@
|
|
|
AND t1.lib_name = #{startName}
|
|
|
</if>
|
|
|
<if test="startSex != null or startAge != null">
|
|
|
+ AND c1.is_deleted = 'N'
|
|
|
+ <if test="startSex != null">
|
|
|
+ <if test="startSex == 3">
|
|
|
+ and c1.sex_type in ('1','2','3')
|
|
|
+ </if>
|
|
|
+ <if test="startSex != 3">
|
|
|
+ and c1.sex_type in ('3',#{startSex})
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="startAge != null">
|
|
|
+ <![CDATA[ AND c1.min_age <= #{startAge} ]]>
|
|
|
+ <![CDATA[ AND c1.max_age >= #{startAge} ]]>
|
|
|
+ </if>
|
|
|
AND t2.start_id = c1.concept_id
|
|
|
</if>
|
|
|
<if test="startType != null">
|
|
@@ -97,6 +72,19 @@
|
|
|
AND t3.lib_name = #{endName}
|
|
|
</if>
|
|
|
<if test="endSex != null or endAge != null">
|
|
|
+ AND c2.is_deleted = 'N'
|
|
|
+ <if test="endSex != null">
|
|
|
+ <if test="endSex == 3">
|
|
|
+ and c2.sex_type in ('1','2','3')
|
|
|
+ </if>
|
|
|
+ <if test="endSex != 3">
|
|
|
+ and c2.sex_type in ('3',#{endSex})
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="endAge != null">
|
|
|
+ <![CDATA[ AND c2.min_age <= #{endAge} ]]>
|
|
|
+ <![CDATA[ AND c2.max_age >= #{endAge} ]]>
|
|
|
+ </if>
|
|
|
AND t2.end_id = c2.concept_id
|
|
|
</if>
|
|
|
<if test="endType != null">
|
|
@@ -115,53 +103,15 @@
|
|
|
`kl_concept` t1,
|
|
|
`kl_relation` t2,
|
|
|
<if test="startSex != null or startAge != null">
|
|
|
- (
|
|
|
- SELECT
|
|
|
- concept_id
|
|
|
- FROM
|
|
|
- kl_concept_common
|
|
|
- WHERE
|
|
|
- is_deleted = 'N'
|
|
|
- <if test="startSex != null">
|
|
|
- <if test="startSex == 3">
|
|
|
- and sex_type in ('1','2','3')
|
|
|
- </if>
|
|
|
- <if test="startSex != 3">
|
|
|
- and sex_type in ('3',#{startSex})
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="startAge != null">
|
|
|
- <![CDATA[ AND min_age <= #{startAge} ]]>
|
|
|
- <![CDATA[ AND max_age >= #{startAge} ]]>
|
|
|
- </if>
|
|
|
- ) c1,
|
|
|
+ kl_concept_common c1,
|
|
|
</if>
|
|
|
<if test="endSex != null or endAge != null">
|
|
|
- (
|
|
|
- SELECT
|
|
|
- concept_id
|
|
|
- FROM
|
|
|
- kl_concept_common
|
|
|
- WHERE
|
|
|
- is_deleted = 'N'
|
|
|
- <if test="endSex != null">
|
|
|
- <if test="endSex == 3">
|
|
|
- and sex_type in ('1','2','3')
|
|
|
- </if>
|
|
|
- <if test="endSex != 3">
|
|
|
- and sex_type in ('3',#{endSex})
|
|
|
- </if>
|
|
|
- </if>
|
|
|
- <if test="endAge != null">
|
|
|
- <![CDATA[ AND min_age <= #{endAge} ]]>
|
|
|
- <![CDATA[ AND max_age >= #{endAge} ]]>
|
|
|
- </if>
|
|
|
- ) c2,
|
|
|
+ kl_concept_common c2,
|
|
|
</if>
|
|
|
`kl_concept` t3,
|
|
|
`kl_relation_order` t4
|
|
|
WHERE
|
|
|
- t1.is_deleted = 'N'
|
|
|
+ t1.is_deleted = 'N'
|
|
|
AND t2.is_deleted = 'N'
|
|
|
AND t3.is_deleted = 'N'
|
|
|
AND t4.is_deleted = 'N'
|
|
@@ -175,8 +125,27 @@
|
|
|
AND t1.lib_name = #{startName}
|
|
|
</if>
|
|
|
<if test="startSex != null or startAge != null">
|
|
|
+ AND c1.is_deleted = 'N'
|
|
|
+ <if test="startSex != null">
|
|
|
+ <if test="startSex == 3">
|
|
|
+ and c1.sex_type in ('1','2','3')
|
|
|
+ </if>
|
|
|
+ <if test="startSex != 3">
|
|
|
+ and c1.sex_type in ('3',#{startSex})
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="startAge != null">
|
|
|
+ <![CDATA[ AND c1.min_age <= #{startAge} ]]>
|
|
|
+ <![CDATA[ AND c1.max_age >= #{startAge} ]]>
|
|
|
+ </if>
|
|
|
AND t2.start_id = c1.concept_id
|
|
|
</if>
|
|
|
+ <if test="startNameList != null and startNameList.size() > 0">
|
|
|
+ AND t1.lib_name in
|
|
|
+ <foreach collection="startNameList" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="startType != null">
|
|
|
AND t1.lib_type = #{startType}
|
|
|
</if>
|
|
@@ -190,8 +159,27 @@
|
|
|
AND t3.lib_name = #{endName}
|
|
|
</if>
|
|
|
<if test="endSex != null or endAge != null">
|
|
|
+ AND c2.is_deleted = 'N'
|
|
|
+ <if test="endSex != null">
|
|
|
+ <if test="endSex == 3">
|
|
|
+ and c2.sex_type in ('1','2','3')
|
|
|
+ </if>
|
|
|
+ <if test="endSex != 3">
|
|
|
+ and c2.sex_type in ('3',#{endSex})
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
+ <if test="endAge != null">
|
|
|
+ <![CDATA[ AND c2.min_age <= #{endAge} ]]>
|
|
|
+ <![CDATA[ AND c2.max_age >= #{endAge} ]]>
|
|
|
+ </if>
|
|
|
AND t2.end_id = c2.concept_id
|
|
|
</if>
|
|
|
+ <if test="endNameList != null and endNameList.size() > 0">
|
|
|
+ AND t3.lib_name in
|
|
|
+ <foreach collection="endNameList" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="endType != null">
|
|
|
AND t3.lib_type = #{endType}
|
|
|
</if>
|