<?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.xhkjedu.smarking.mapper.report.reportother.MsrReportparamMapper">

    <!--获取考试对应参数-->
    <select id="listReportparamByRpbelong" resultType="com.xhkjedu.smarking.model.report.reportother.MsrReportparam">
        select * from msr_reportparam where examid=#{examid}
        <if test="rpbelong!= null and rpbelong!= ''">
            and rpbelong = #{rpbelong}
        </if>
        <if test="reportcode!= null and reportcode!= ''">
            and reportcode = #{reportcode}
        </if>
        order by rpid
    </select>

    <!--获取科目对应参数-->
    <select id="getReportparamByRpbelongSubject" resultType="com.xhkjedu.smarking.model.report.reportother.MsrReportparam">
        select *
        from msr_reportparam
        where examid=#{examid} and rpbelong = #{rpbelong} and reportcode = #{reportcode}
        <if test="subjectid!= null and subjectid!= ''">
            and subjectid = #{subjectid}
        </if>
        limit 1
    </select>
    <!--获取含有类型的对应类型参数-->
    <select id="getReportparamByRpbelongSubjectType" resultType="com.xhkjedu.smarking.model.report.reportother.MsrReportparam">
        select * from msr_reportparam where examid=#{examid} and rpbelong = #{rpbelong} and
            reportcode = #{reportcode} and subjectid = #{subjectid} and rptype = #{rptype} limit 1
    </select>

    <!--删除-->
    <delete id="deleteBatchReportparam">
        delete from msp_reportparam where rpid in
        <foreach collection="list" item="rpid" open="(" separator="," close=")">#{rpid}</foreach>
    </delete>

    <!--删除考试对应类型参数-->
    <delete id="deleteByExamidAndRpbelong">
        delete from msp_reportparam where examid = #{examid} and rpbelong = #{rpbelong}
        <if test="rptype!= null and rptype!= 0">and rptype = #{rptype}</if>
    </delete>
</mapper>
