|
@@ -102,143 +102,178 @@
|
|
|
|
|
|
|
|
|
<select id="getList" resultType="com.diagbot.dto.QuestionPageDTO">
|
|
|
- SELECT e.* FROM(SELECT
|
|
|
- a.id,
|
|
|
- a.is_deleted,
|
|
|
- a.gmt_create,
|
|
|
- a.gmt_modified,
|
|
|
- a.creator,
|
|
|
- a.modifier,
|
|
|
- a.tag_name,
|
|
|
- a.`name`,
|
|
|
- a.description,
|
|
|
- a.`sex_type`,
|
|
|
- a.age_begin,
|
|
|
- a.age_end,
|
|
|
- a.tag_type,
|
|
|
- a.control_type,
|
|
|
- a.type,
|
|
|
- a.item_type,
|
|
|
- a.label_prefix,
|
|
|
- a.label_suffix,
|
|
|
- a.url,
|
|
|
- a.spec_flag,
|
|
|
- a.required,
|
|
|
- a.explains,
|
|
|
- c.tag_name combinationName,
|
|
|
- a.remark
|
|
|
- FROM
|
|
|
- `prec_question_info` a,
|
|
|
- prec_question_info c,
|
|
|
- prec_question_mapping b
|
|
|
- WHERE
|
|
|
- a.is_deleted = 'N'
|
|
|
- AND b.is_deleted = 'N'
|
|
|
- AND c.is_deleted = 'N'
|
|
|
- AND a.id = b.son_question
|
|
|
- AND c.id = b.parent_question
|
|
|
- <if test="combinationName != null and combinationName != ''">
|
|
|
- AND b.parent_question IN (-- 搜索所有组合项的id
|
|
|
- SELECT
|
|
|
- f.id
|
|
|
+ <if test="callType != null and callType == 1">
|
|
|
+ SELECT e.* FROM(SELECT
|
|
|
+ a.id,
|
|
|
+ a.is_deleted,
|
|
|
+ a.gmt_create,
|
|
|
+ a.gmt_modified,
|
|
|
+ a.creator,
|
|
|
+ a.modifier,
|
|
|
+ a.tag_name,
|
|
|
+ a.`name`,
|
|
|
+ a.description,
|
|
|
+ a.`sex_type`,
|
|
|
+ a.age_begin,
|
|
|
+ a.age_end,
|
|
|
+ a.tag_type,
|
|
|
+ a.control_type,
|
|
|
+ a.type,
|
|
|
+ a.item_type,
|
|
|
+ a.label_prefix,
|
|
|
+ a.label_suffix,
|
|
|
+ a.url,
|
|
|
+ a.spec_flag,
|
|
|
+ a.required,
|
|
|
+ a.explains,
|
|
|
+ c.tag_name combinationName,
|
|
|
+ a.remark
|
|
|
FROM
|
|
|
- `prec_question_info` f
|
|
|
+ `prec_question_info` a,
|
|
|
+ prec_question_info c,
|
|
|
+ prec_question_mapping b
|
|
|
WHERE
|
|
|
- f.is_deleted = 'N'
|
|
|
- )
|
|
|
- </if>
|
|
|
- <if test="combinationName != null and combinationName != ''">
|
|
|
- AND c.tag_name like concat ('%', #{combinationName}, '%')
|
|
|
- </if>
|
|
|
+ a.is_deleted = 'N'
|
|
|
+ AND b.is_deleted = 'N'
|
|
|
+ AND c.is_deleted = 'N'
|
|
|
+ AND a.id = b.son_question
|
|
|
+ AND c.id = b.parent_question
|
|
|
+ <if test="combinationName != null and combinationName != ''">
|
|
|
+ AND b.parent_question IN (-- 搜索所有组合项的id
|
|
|
+ SELECT
|
|
|
+ f.id
|
|
|
+ FROM
|
|
|
+ `prec_question_info` f
|
|
|
+ WHERE
|
|
|
+ f.is_deleted = 'N'
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="combinationName != null and combinationName != ''">
|
|
|
+ AND c.tag_name like concat ('%', #{combinationName}, '%')
|
|
|
+ </if>
|
|
|
|
|
|
- <if test="type != null and type != ''">
|
|
|
- AND a.type = #{type}
|
|
|
- </if>
|
|
|
- <if test="name != null and name != ''">
|
|
|
- AND a.name like concat ('%', #{name}, '%')
|
|
|
- </if>
|
|
|
- <if test="tagName != null and tagName != ''">
|
|
|
- AND a.tag_name like concat ('%', #{tagName}, '%')
|
|
|
- </if>
|
|
|
- <if test="notTypeList != null and notTypeList.size() > 0 ">
|
|
|
- and a.type not in
|
|
|
- <foreach collection="notTypeList" item="notType" open="(" separator="," close=")">
|
|
|
- #{notType}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="tagTypeList != null and tagTypeList.size() > 0 ">
|
|
|
- and a.tag_type in
|
|
|
- <foreach collection="tagTypeList" item="tagType" open="(" separator="," close=")">
|
|
|
- #{tagType}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="controlTypeList != null and controlTypeList.size() > 0 ">
|
|
|
- and a.control_type in
|
|
|
- <foreach collection="controlTypeList" item="controlType" open="(" separator="," close=")">
|
|
|
- #{controlType}
|
|
|
- </foreach>
|
|
|
- </if>
|
|
|
- <if test="combinationName == null or combinationName == ''">
|
|
|
- UNION
|
|
|
- SELECT d.id,
|
|
|
- d.is_deleted,
|
|
|
- d.gmt_create,
|
|
|
- d.gmt_modified,
|
|
|
- d.creator,
|
|
|
- d.modifier,
|
|
|
- d.tag_name,
|
|
|
- d.`name`,
|
|
|
- d.description,
|
|
|
- d.`sex_type`,
|
|
|
- d.age_begin,
|
|
|
- d.age_end,
|
|
|
- d.tag_type,
|
|
|
- d.control_type,
|
|
|
- d.type,
|
|
|
- d.item_type,
|
|
|
- d.label_prefix,
|
|
|
- d.label_suffix,
|
|
|
- d.url,
|
|
|
- d.spec_flag,
|
|
|
- d.required,
|
|
|
- d.explains,
|
|
|
- null combinationName,
|
|
|
- d.remark FROM prec_question_info d
|
|
|
- WHERE
|
|
|
- d.is_deleted = 'N'
|
|
|
<if test="type != null and type != ''">
|
|
|
- AND d.type = #{type}
|
|
|
- </if>
|
|
|
- <if test="tagName != null and tagName != ''">
|
|
|
- AND d.tag_name like concat ('%', #{tagName}, '%')
|
|
|
+ AND a.type = #{type}
|
|
|
</if>
|
|
|
<if test="name != null and name != ''">
|
|
|
- AND d.name like concat ('%', #{name}, '%')
|
|
|
+ AND a.name like concat ('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="tagName != null and tagName != ''">
|
|
|
+ AND a.tag_name like concat ('%', #{tagName}, '%')
|
|
|
</if>
|
|
|
<if test="notTypeList != null and notTypeList.size() > 0 ">
|
|
|
- and d.type not in
|
|
|
+ and a.type not in
|
|
|
<foreach collection="notTypeList" item="notType" open="(" separator="," close=")">
|
|
|
#{notType}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="tagTypeList != null and tagTypeList.size() > 0 ">
|
|
|
- and d.tag_type in
|
|
|
+ and a.tag_type in
|
|
|
<foreach collection="tagTypeList" item="tagType" open="(" separator="," close=")">
|
|
|
#{tagType}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="controlTypeList != null and controlTypeList.size() > 0 ">
|
|
|
- and d.control_type in
|
|
|
+ and a.control_type in
|
|
|
<foreach collection="controlTypeList" item="controlType" open="(" separator="," close=")">
|
|
|
#{controlType}
|
|
|
</foreach>
|
|
|
</if>
|
|
|
- </if>
|
|
|
+ <if test="combinationName == null or combinationName == ''">
|
|
|
+ UNION
|
|
|
+ SELECT d.id,
|
|
|
+ d.is_deleted,
|
|
|
+ d.gmt_create,
|
|
|
+ d.gmt_modified,
|
|
|
+ d.creator,
|
|
|
+ d.modifier,
|
|
|
+ d.tag_name,
|
|
|
+ d.`name`,
|
|
|
+ d.description,
|
|
|
+ d.`sex_type`,
|
|
|
+ d.age_begin,
|
|
|
+ d.age_end,
|
|
|
+ d.tag_type,
|
|
|
+ d.control_type,
|
|
|
+ d.type,
|
|
|
+ d.item_type,
|
|
|
+ d.label_prefix,
|
|
|
+ d.label_suffix,
|
|
|
+ d.url,
|
|
|
+ d.spec_flag,
|
|
|
+ d.required,
|
|
|
+ d.explains,
|
|
|
+ null combinationName,
|
|
|
+ d.remark FROM prec_question_info d
|
|
|
+ WHERE
|
|
|
+ d.is_deleted = 'N'
|
|
|
+ <if test="type != null and type != ''">
|
|
|
+ AND d.type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="tagName != null and tagName != ''">
|
|
|
+ AND d.tag_name like concat ('%', #{tagName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND d.name like concat ('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="notTypeList != null and notTypeList.size() > 0 ">
|
|
|
+ and d.type not in
|
|
|
+ <foreach collection="notTypeList" item="notType" open="(" separator="," close=")">
|
|
|
+ #{notType}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="tagTypeList != null and tagTypeList.size() > 0 ">
|
|
|
+ and d.tag_type in
|
|
|
+ <foreach collection="tagTypeList" item="tagType" open="(" separator="," close=")">
|
|
|
+ #{tagType}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="controlTypeList != null and controlTypeList.size() > 0 ">
|
|
|
+ and d.control_type in
|
|
|
+ <foreach collection="controlTypeList" item="controlType" open="(" separator="," close=")">
|
|
|
+ #{controlType}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ </if>
|
|
|
) e
|
|
|
GROUP BY
|
|
|
e.id
|
|
|
order by
|
|
|
e.gmt_modified desc
|
|
|
+ </if>
|
|
|
+ <if test="callType != null and callType == 2">
|
|
|
+ SELECT a.* FROM `prec_question_info` a
|
|
|
+ WHERE a.is_deleted = 'N'
|
|
|
+ <if test="type != null and type != ''">
|
|
|
+ AND a.type = #{type}
|
|
|
+ </if>
|
|
|
+ <if test="tagName != null and tagName != ''">
|
|
|
+ AND a.tag_name like concat ('%', #{tagName}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="name != null and name != ''">
|
|
|
+ AND a.name like concat ('%', #{name}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="notTypeList != null and notTypeList.size() > 0 ">
|
|
|
+ and a.type not in
|
|
|
+ <foreach collection="notTypeList" item="notType" open="(" separator="," close=")">
|
|
|
+ #{notType}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="tagTypeList != null and tagTypeList.size() > 0 ">
|
|
|
+ and a.tag_type in
|
|
|
+ <foreach collection="tagTypeList" item="tagType" open="(" separator="," close=")">
|
|
|
+ #{tagType}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="controlTypeList != null and controlTypeList.size() > 0 ">
|
|
|
+ and a.control_type in
|
|
|
+ <foreach collection="controlTypeList" item="controlType" open="(" separator="," close=")">
|
|
|
+ #{controlType}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ order by a.gmt_modified desc
|
|
|
+ </if>
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
|