<?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.CompareMessageMapper">
    <select id="getCompareMessage" resultType="cn.cslg.report.common.model.vo.CompareMessageVO">
        select a.* ,b.TARGET_DESCRIPTION,b.COMPARE_DESCRIPTION,b.COMPARE_RESULT from FEATURES a left join COMPARE_MESSAGE b on a.id =b.FEATURE_ID
        where a.SIGN_PATENT_NO=#{patentNo} and a.TASK_ID=#{taskId};
    </select>

    <select id="getComparedMessage" resultType="java.lang.String">
        select DISTINCT f.SIGN_PATENT_NO from FEATURES f left join COMPARE_MESSAGE cm on f.ID =cm.FEATURE_ID
        <where>
            and f.REPORT_ID=#{params.reportId}
            and cm.ID is not null
            <if test="params.compareResult !=null">
             and   cm.COMPARE_RESULT=#{params.compareResult}
            </if>
            <if test="params.compareResult !=null">
                and   cm.COMPARE_RESULT=#{params.compareResult}
            </if>
        </where>


    </select>
    <select id="getComparedMessageAll" resultType="java.lang.String">
        select DISTINCT f.SIGN_PATENT_NO from RMS_TEST.FEATURES f left join RMS_TEST.COMPARE_MESSAGE cm on f.ID =cm.FEATURE_ID
        <where>
            and f.REPORT_ID=#{params.reportId}
            and cm.ID is not null
            <if test="params.patentNo !=null">
                and f.SIGN_PATENT_NO=
                like concat('%', #{params.patentNo}, '%')
            </if>
            <if test="params.compareResult !=null">
                and   cm.COMPARE_RESULT=#{params.compareResult}
            </if>
        </where>
    </select>
</mapper>