<?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.ruoyi.mxjb.mapper.MxjbPaperExamineeMapper">
    
    <resultMap type="MxjbPaperExaminee" id="MxjbPaperExamineeResult">
        <result property="examineeId"    column="examinee_id"    />
        <result property="paperId"    column="paper_id"    />
        <result property="customerCode"    column="customer_code"    />
        <result property="beginTime"    column="begin_time"    />
        <result property="endTime"    column="end_time"    />
        <result property="state"    column="state"    />
        <result property="scoreLevel"    column="score_level"    />
        <result property="score"    column="score"    />
        <result property="scoreRate"    column="score_rate"    />
        <result property="ranking"    column="ranking"    />
        <result property="gradeRanking"    column="grade_ranking"    />
        <result property="chooseCount"    column="choose_count"    />
        <result property="chooseTotal"    column="choose_total"    />
        <result property="subjectiveCount"    column="subjective_count"    />
        <result property="subjectiveTotal"    column="subjective_total"    />
    </resultMap>

    <sql id="selectMxjbPaperExamineeVo">
        select examinee_id, paper_id, customer_code, begin_time, end_time, state, score_level, score, score_rate, ranking, grade_ranking, choose_count, choose_total, subjective_count, subjective_total from mxjb_paper_examinee
    </sql>

    <select id="selectMxjbPaperExamineeList" parameterType="MxjbPaperExaminee" resultMap="MxjbPaperExamineeResult">
        <include refid="selectMxjbPaperExamineeVo"/>
        <where>  
            <if test="paperId != null "> and paper_id = #{paperId}</if>
            <if test="customerCode != null  and customerCode != ''"> and customer_code = #{customerCode}</if>
            <if test="beginTime != null "> and begin_time = #{beginTime}</if>
            <if test="endTime != null "> and end_time = #{endTime}</if>
            <if test="state != null "> and state = #{state}</if>
            <if test="scoreLevel != null  and scoreLevel != ''"> and score_level = #{scoreLevel}</if>
            <if test="score != null "> and score = #{score}</if>
            <if test="scoreRate != null "> and score_rate = #{scoreRate}</if>
            <if test="ranking != null "> and ranking = #{ranking}</if>
            <if test="gradeRanking != null "> and grade_ranking = #{gradeRanking}</if>
            <if test="chooseCount != null "> and choose_count = #{chooseCount}</if>
            <if test="chooseTotal != null "> and choose_total = #{chooseTotal}</if>
            <if test="subjectiveCount != null "> and subjective_count = #{subjectiveCount}</if>
            <if test="subjectiveTotal != null "> and subjective_total = #{subjectiveTotal}</if>
        </where>
    </select>
    
    <select id="selectMxjbPaperExamineeById" parameterType="Long" resultMap="MxjbPaperExamineeResult">
        <include refid="selectMxjbPaperExamineeVo"/>
        where examinee_id = #{examineeId}
    </select>
        
    <insert id="insertMxjbPaperExaminee" parameterType="MxjbPaperExaminee" useGeneratedKeys="true" keyProperty="examineeId">
        insert into mxjb_paper_examinee
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="paperId != null">paper_id,</if>
            <if test="customerCode != null">customer_code,</if>
            <if test="beginTime != null">begin_time,</if>
            <if test="endTime != null">end_time,</if>
            <if test="state != null">state,</if>
            <if test="scoreLevel != null">score_level,</if>
            <if test="score != null">score,</if>
            <if test="scoreRate != null">score_rate,</if>
            <if test="ranking != null">ranking,</if>
            <if test="gradeRanking != null">grade_ranking,</if>
            <if test="chooseCount != null">choose_count,</if>
            <if test="chooseTotal != null">choose_total,</if>
            <if test="subjectiveCount != null">subjective_count,</if>
            <if test="subjectiveTotal != null">subjective_total,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="paperId != null">#{paperId},</if>
            <if test="customerCode != null">#{customerCode},</if>
            <if test="beginTime != null">#{beginTime},</if>
            <if test="endTime != null">#{endTime},</if>
            <if test="state != null">#{state},</if>
            <if test="scoreLevel != null">#{scoreLevel},</if>
            <if test="score != null">#{score},</if>
            <if test="scoreRate != null">#{scoreRate},</if>
            <if test="ranking != null">#{ranking},</if>
            <if test="gradeRanking != null">#{gradeRanking},</if>
            <if test="chooseCount != null">#{chooseCount},</if>
            <if test="chooseTotal != null">#{chooseTotal},</if>
            <if test="subjectiveCount != null">#{subjectiveCount},</if>
            <if test="subjectiveTotal != null">#{subjectiveTotal},</if>
         </trim>
    </insert>

    <update id="updateMxjbPaperExaminee" parameterType="MxjbPaperExaminee">
        update mxjb_paper_examinee
        <trim prefix="SET" suffixOverrides=",">
            <if test="paperId != null">paper_id = #{paperId},</if>
            <if test="customerCode != null">customer_code = #{customerCode},</if>
            <if test="beginTime != null">begin_time = #{beginTime},</if>
            <if test="endTime != null">end_time = #{endTime},</if>
            <if test="state != null">state = #{state},</if>
            <if test="scoreLevel != null">score_level = #{scoreLevel},</if>
            <if test="score != null">score = #{score},</if>
            <if test="scoreRate != null">score_rate = #{scoreRate},</if>
            <if test="ranking != null">ranking = #{ranking},</if>
            <if test="gradeRanking != null">grade_ranking = #{gradeRanking},</if>
            <if test="chooseCount != null">choose_count = #{chooseCount},</if>
            <if test="chooseTotal != null">choose_total = #{chooseTotal},</if>
            <if test="subjectiveCount != null">subjective_count = #{subjectiveCount},</if>
            <if test="subjectiveTotal != null">subjective_total = #{subjectiveTotal},</if>
        </trim>
        where examinee_id = #{examineeId}
    </update>

    <delete id="deleteMxjbPaperExamineeById" parameterType="Long">
        delete from mxjb_paper_examinee where examinee_id = #{examineeId}
    </delete>

    <delete id="deleteMxjbPaperExamineeByIds" parameterType="String">
        delete from mxjb_paper_examinee where examinee_id in 
        <foreach item="examineeId" collection="array" open="(" separator="," close=")">
            #{examineeId}
        </foreach>
    </delete>
</mapper>