wangyu 5 years ago
parent
commit
ac20463375

+ 1 - 0
precman-service/src/main/java/com/diagbot/vo/QuestionPageVO.java

@@ -20,6 +20,7 @@ public class QuestionPageVO extends Page {
     private List<Integer> tagTypeList;
     private List<Integer> controlTypeList;
     private List<Integer> notTypeList;
+    private Integer callType;//调用类型(1.独立填写单 2.组合填写单)
     private String combinationName;//组合项名称
     private String name;//界面名称
 }

+ 145 - 110
precman-service/src/main/resources/mapper/QuestionInfoMapper.xml

@@ -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>