123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.diagbot.mapper.QuestionInfoMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.QuestionInfo">
- <id column="id" property="id" />
- <result column="is_deleted" property="isDeleted" />
- <result column="gmt_create" property="gmtCreate" />
- <result column="gmt_modified" property="gmtModified" />
- <result column="creator" property="creator" />
- <result column="modifier" property="modifier" />
- <result column="tag_name" property="tagName" />
- <result column="name" property="name" />
- <result column="sex_type" property="sexType" />
- <result column="age_begin" property="ageBegin" />
- <result column="age_end" property="ageEnd" />
- <result column="tag_type" property="tagType" />
- <result column="control_type" property="controlType" />
- <result column="type" property="type" />
- <result column="item_type" property="itemType" />
- <result column="label_prefix" property="labelPrefix" />
- <result column="label_suffix" property="labelSuffix" />
- <result column="url" property="url" />
- <result column="description" property="description" />
- <result column="remark" property="remark" />
- </resultMap>
- <delete id="deleteByIds" parameterType="java.util.Map">
- update `prec_question_info`
- set gmt_modified = #{gmtModified}, modifier = #{modifier}, is_deleted = #{delete}
- where is_deleted = 'N'
- and id in
- <foreach item="id" collection="ids" open="(" separator="," close=")" >
- #{id}
- </foreach>
- </delete>
- <select id="index" parameterType="java.util.Map" resultType="com.diagbot.entity.QuestionInfo">
- select * from `prec_question_info`
- where is_deleted = 'N'
- <if test="tagName != null and tagName != ''">
- and tag_name like concat("%", #{tagName}, "%")
- </if>
- <if test="existName != null and existName != ''">
- and tag_name = #{existName}
- </if>
- <if test="sexType != null and sexType != 3 and sexType != ''">
- and sex_type in (3, #{sexType})
- </if>
- <if test="age != null and age != ''">
- <![CDATA[ and age_begin <= #{age} ]]>
- <![CDATA[ and age_end >= #{age} ]]>
- </if>
- <if test="type != null and type != ''">
- and type = #{type}
- </if>
- <if test="controlType != null and controlType.size() > 0">
- and control_type in
- <foreach collection="controlType" item="controlType" open="(" separator="," close=")">
- #{controlType}
- </foreach>
- </if>
- <if test="tagType != null and tagType.size() > 0">
- and tag_type in
- <foreach collection="tagType" item="tagType" open="(" separator="," close=")">
- #{tagType}
- </foreach>
- </if>
- <if test="notTagType != null and notTagType.size() > 0">
- and tag_type not in
- <foreach collection="notTagType" item="notTagType" open="(" separator="," close=")">
- #{notTagType}
- </foreach>
- </if>
- <if test="notControlType != null and notControlType.size() > 0">
- and control_type not in
- <foreach collection="notControlType" item="notControlType" open="(" separator="," close=")">
- #{notControlType}
- </foreach>
- </if>
- <if test="notIds != null and notIds.size() > 0 ">
- and id not in
- <foreach collection="notIds" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- <if test=" ids != null and ids.size() > 0 ">
- and id in
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- order by gmt_modified desc
- </select>
- <select id="getList" resultType="com.diagbot.dto.QuestionPageDTO">
- 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="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
- </select>
- <select id="getParent" resultMap="BaseResultMap">
- SELECT a.* FROM `prec_question_info` a, prec_question_mapping b
- where a.is_deleted = 'N' and b.is_deleted = 'N' and a.id = b.parent_question
- and b.son_question = #{id}
- </select>
- <select id="getByQuestionMapping" parameterType="java.util.Map" resultType="com.diagbot.entity.wrapper.QuestionInfoWrapper">
- select t.*, m.parent_question, m.position, m.form_position , m.exclusion_type, m.symptom_type from prec_question_info t, prec_question_mapping m
- where t.is_deleted = 'N' and m.is_deleted = 'N' and m.son_question = t.id
- <if test="id != null">
- and m.parent_question = #{id}
- </if>
- <if test="ids != null and ids.size > 0">
- <foreach item="myId" collection="ids" open="and(" separator="or" close=")" >
- m.parent_question = #{myId}
- </foreach>
- </if>
- <if test="sexType != null and sexType != 3 and sexType != ''">
- and t.sex_type in (3, #{sexType})
- </if>
- <if test="age != null">
- <![CDATA[ and t.age_begin <= #{age} ]]>
- <![CDATA[ and t.age_end >= #{age} ]]>
- </if>
- <if test="id != null">
- order by m.order_no
- </if>
- <if test="ids != null and ids.size > 0">
- order by m.parent_question, m.order_no
- </if>
- </select>
- <select id="getByParam" parameterType="java.util.Map" resultMap="BaseResultMap">
- select * from prec_question_info where is_deleted = 'N'
- and id = #{id}
- <if test="sexType != null and sexType != 3 and sexType != ''">
- and sex_type in (3, #{sexType})
- </if>
- <if test="age != null and age != ''">
- <![CDATA[ and age_begin <= #{age} ]]>
- <![CDATA[ and age_end >= #{age} ]]>
- </if>
- </select>
- </mapper>
|