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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.diagbot.entity.RetrievalMapping">
        <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="retrieval_id" property="retrievalId" />
        <result column="question_id" property="questionId" />
        <result column="show_type" property="showType" />
        <result column="remark" property="remark" />
    </resultMap>
    
    <select id="getMapCouByQuesIds" parameterType="list" resultType="map">
    	select 
    	a.question_id as questionId,
    	count(1) as cou
		from icss_retrieval_mapping a
		join icss_retrieval b on a.retrieval_id=b.id
		where a.is_deleted = 'N' and b.is_deleted = 'N'
		and a.question_id in
		<foreach collection="list" open="(" close=")" separator="," item="quid">
			#{quid}
		</foreach>
		group by a.question_id
    </select>

</mapper>
