|
@@ -24,6 +24,50 @@
|
|
FROM
|
|
FROM
|
|
`kl_concept` t1,
|
|
`kl_concept` t1,
|
|
`kl_relation` t2,
|
|
`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,
|
|
|
|
+ </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,
|
|
|
|
+ </if>
|
|
`kl_concept` t3
|
|
`kl_concept` t3
|
|
WHERE
|
|
WHERE
|
|
t1.is_deleted = 'N'
|
|
t1.is_deleted = 'N'
|
|
@@ -38,26 +82,7 @@
|
|
AND t1.lib_name = #{startName}
|
|
AND t1.lib_name = #{startName}
|
|
</if>
|
|
</if>
|
|
<if test="startSex != null or startAge != null">
|
|
<if test="startSex != null or startAge != null">
|
|
- AND t2.start_id in (
|
|
|
|
- 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>
|
|
|
|
- )
|
|
|
|
|
|
+ AND t2.start_id = c1.concept_id
|
|
</if>
|
|
</if>
|
|
<if test="startType != null">
|
|
<if test="startType != null">
|
|
AND t1.lib_type = #{startType}
|
|
AND t1.lib_type = #{startType}
|
|
@@ -72,26 +97,7 @@
|
|
AND t3.lib_name = #{endName}
|
|
AND t3.lib_name = #{endName}
|
|
</if>
|
|
</if>
|
|
<if test="endSex != null or endAge != null">
|
|
<if test="endSex != null or endAge != null">
|
|
- AND t2.end_id in (
|
|
|
|
- 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>
|
|
|
|
- )
|
|
|
|
|
|
+ AND t2.end_id = c2.concept_id
|
|
</if>
|
|
</if>
|
|
<if test="endType != null">
|
|
<if test="endType != null">
|
|
AND t3.lib_type = #{endType}
|
|
AND t3.lib_type = #{endType}
|
|
@@ -108,6 +114,50 @@
|
|
FROM
|
|
FROM
|
|
`kl_concept` t1,
|
|
`kl_concept` t1,
|
|
`kl_relation` t2,
|
|
`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,
|
|
|
|
+ </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,
|
|
|
|
+ </if>
|
|
`kl_concept` t3,
|
|
`kl_concept` t3,
|
|
`kl_relation_order` t4
|
|
`kl_relation_order` t4
|
|
WHERE
|
|
WHERE
|
|
@@ -125,26 +175,7 @@
|
|
AND t1.lib_name = #{startName}
|
|
AND t1.lib_name = #{startName}
|
|
</if>
|
|
</if>
|
|
<if test="startSex != null or startAge != null">
|
|
<if test="startSex != null or startAge != null">
|
|
- AND t2.start_id in (
|
|
|
|
- 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>
|
|
|
|
- )
|
|
|
|
|
|
+ AND t2.start_id = c1.concept_id
|
|
</if>
|
|
</if>
|
|
<if test="startType != null">
|
|
<if test="startType != null">
|
|
AND t1.lib_type = #{startType}
|
|
AND t1.lib_type = #{startType}
|
|
@@ -159,26 +190,7 @@
|
|
AND t3.lib_name = #{endName}
|
|
AND t3.lib_name = #{endName}
|
|
</if>
|
|
</if>
|
|
<if test="endSex != null or endAge != null">
|
|
<if test="endSex != null or endAge != null">
|
|
- AND t2.end_id in (
|
|
|
|
- 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>
|
|
|
|
- )
|
|
|
|
|
|
+ AND t2.end_id = c2.concept_id
|
|
</if>
|
|
</if>
|
|
<if test="endType != null">
|
|
<if test="endType != null">
|
|
AND t3.lib_type = #{endType}
|
|
AND t3.lib_type = #{endType}
|