123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?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.RetrievalMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.diagbot.entity.Retrieval">
- <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="name" property="name" />
- <result column="spell" property="spell" />
- <result column="remark" property="remark" />
- </resultMap>
- <select id="getSymptopInfo" resultType="com.diagbot.dto.RetrievalDTO">
- SELECT a.`name` as retrieval_name,c.id as question_id,b.show_type FROM icss_retrieval a
- LEFT JOIN icss_retrieval_mapping b ON a.id = b.retrieval_id
- LEFT JOIN icss_question_info c ON b.question_id = c.id
- WHERE a.is_deleted = 'N' AND b.is_deleted = 'N' AND c.is_deleted = 'N'
- AND (a.spell = #{InputStr} or a.`name` = #{InputStr})
- AND c.type = #{type}
- <if test="age != null and age != ''">
- <![CDATA[ and c.age_begin <= #{age} ]]>
- <![CDATA[ and c.age_end >= #{age} ]]>
- </if>
- <if test="tagType != null and tagType != ''">
- <![CDATA[ and c.tag_type = #{tagType} ]]>
- </if>
- <if test="itemType != null">
- <![CDATA[ and c.item_type = #{itemType} ]]>
- </if>
- <if test="sexType == 3">
- and c.sex_type in ('1','2','3')
- </if>
- <if test="sexType != 3">
- and c.sex_type in ('3',#{sexType})
- </if>
- <if test="inputIds != null and inputIds.size > 0">
- and c.id not in
- <foreach item="id" collection="inputIds" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- UNION
- SELECT a.`name` as retrieval_name,c.id as question_id,b.show_type FROM icss_retrieval a
- LEFT JOIN icss_retrieval_mapping b ON a.id = b.retrieval_id
- LEFT JOIN icss_question_info c ON b.question_id = c.id
- WHERE a.is_deleted = 'N' AND b.is_deleted = 'N' AND c.is_deleted = 'N'
- AND (a.spell LIKE CONCAT(#{InputStr},'%') or a.`name` LIKE CONCAT(#{InputStr},'%'))
- AND c.type = #{type}
- <if test="age != null and age != ''">
- <![CDATA[ and c.age_begin <= #{age} ]]>
- <![CDATA[ and c.age_end >= #{age} ]]>
- </if>
- <if test="tagType != null and tagType != ''">
- <![CDATA[ and c.tag_type = #{tagType} ]]>
- </if>
- <if test="itemType != null">
- <![CDATA[ and c.item_type = #{itemType} ]]>
- </if>
- <if test="sexType == 3">
- and c.sex_type in ('1','2','3')
- </if>
- <if test="sexType != 3">
- and c.sex_type in ('3',#{sexType})
- </if>
- <if test="inputIds != null and inputIds.size > 0">
- and c.id not in
- <foreach item="id" collection="inputIds" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- UNION
- SELECT a.`name` as retrieval_name,c.id as question_id,b.show_type FROM icss_retrieval a
- LEFT JOIN icss_retrieval_mapping b ON a.id = b.retrieval_id
- LEFT JOIN icss_question_info c ON b.question_id = c.id
- WHERE a.is_deleted = 'N' AND b.is_deleted = 'N' AND c.is_deleted = 'N'
- AND (a.spell LIKE CONCAT('%',#{InputStr},'%') or a.`name` LIKE CONCAT('%',#{InputStr},'%'))
- AND c.type = #{type}
- <if test="age != null and age != ''">
- <![CDATA[ and c.age_begin <= #{age} ]]>
- <![CDATA[ and c.age_end >= #{age} ]]>
- </if>
- <if test="tagType != null and tagType != ''">
- <![CDATA[ and c.tag_type = #{tagType} ]]>
- </if>
- <if test="itemType != null">
- <![CDATA[ and c.item_type = #{itemType} ]]>
- </if>
- <if test="sexType == 3">
- and c.sex_type in ('1','2','3')
- </if>
- <if test="sexType != 3">
- and c.sex_type in ('3',#{sexType})
- </if>
- <if test="inputIds != null and inputIds.size > 0">
- and c.id not in
- <foreach item="id" collection="inputIds" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- </select>
- </mapper>
|