<?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.QuestionUsualMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.diagbot.entity.QuestionUsual">
        <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="question_id" property="questionId" />
        <result column="dept_id" property="deptId" />
        <result column="order_no" property="orderNo" />
        <result column="remark" property="remark" />
    </resultMap>

    <select id="getQuestionUsualByQuestionId" resultType="com.diagbot.entity.QuestionUsual">
        SELECT a.* FROM `icss_question_usual` a WHERE a.is_deleted = 'N' AND a.dept_id = #{questionUsualVO.deptId} AND a.type = #{type}
    </select>

    <select id="getQuestionUsualByDeptIds" resultType="com.diagbot.dto.GetQuestionUsualAndTypeDTO">
        SELECT
	      a.*,b.type
        FROM
	      `icss_question_usual` a
        LEFT JOIN icss_question_info b ON a.question_id = b.id
        WHERE
	      a.is_deleted = 'N'
        AND a.dept_id IN
        <foreach item="deptId" collection="deptIds" open="(" separator="," close=")">
            #{deptId}
        </foreach>
    </select>
</mapper>
