<?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="cn.cslg.report.mapper.InvalidReReport.InvalidReasonFiledValueMapper">
    <select id="getValues" resultType="cn.cslg.report.entity.invalidReReport.InvalidReasonFieldValue"
            parameterType="cn.cslg.report.common.model.dto.invalidReReport.InvalidReasonFieldValueDTO">
        select * from INVALID_REASON_FIELD_VALUE
        <where>
            <foreach collection="values" index="index" separator=" or " item="item">
                (INVALID_REASON_FIELD_ID=#{item.fieldId} and INVALID_REASON_ID=#{item.invalidReasonId})
            </foreach>
        </where>
    </select>

    <select id="getListByReasonIds"
            resultType="cn.cslg.report.common.model.dto.invalidReReport.InvalidReasonFieldValueDTO"
            parameterType="java.lang.Integer">
        select a.INVALID_REASON_ID as invalidReasonId ,a.INVALID_REASON_FIELD_ID as fieldId ,a.FIELD_VALUE as
        fieldValue,b.FIELD_KEY as fieldKey  from RMS_TEST.INVALID_REASON_FIELD_VALUE a left join RMS_TEST.INVALID_REASON_FIELD b on
        a.INVALID_REASON_FIELD_ID=b.ID
        <where>
            a.INVALID_REASON_ID in
            <foreach collection="invalidReasonsIds" index="index" separator="," item="item" open="(" close=")">
                #{item}
            </foreach>
        </where>
    </select>
</mapper>