<?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.srs.comprehensive.mapper.CphStuEvaTaskListMapper">
    
    <resultMap type="CphStuEvaTaskList" id="CphStuEvaTaskListResult">
        <result property="id"    column="id"    />
        <result property="evaTaskId"    column="eva_task_id"    />
        <result property="stuNo"    column="stu_no"    />
        <result property="status"    column="status"    />
    </resultMap>

    <sql id="selectCphStuEvaTaskListVo">
        select id, eva_task_id, stu_no, status from cph_stu_eva_task_list
    </sql>

    <select id="selectCphStuEvaTaskListList" parameterType="CphStuEvaTaskList" resultMap="CphStuEvaTaskListResult">
        <include refid="selectCphStuEvaTaskListVo"/>
        <where>  
            <if test="evaTaskId != null "> and eva_task_id = #{evaTaskId}</if>
            <if test="stuNo != null  and stuNo != ''"> and stu_no = #{stuNo}</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectCphStuEvaTaskListById" parameterType="Long" resultMap="CphStuEvaTaskListResult">
        <include refid="selectCphStuEvaTaskListVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertCphStuEvaTaskList" parameterType="CphStuEvaTaskList" useGeneratedKeys="true" keyProperty="id">
        insert into cph_stu_eva_task_list
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="evaTaskId != null">eva_task_id,</if>
            <if test="stuNo != null">stu_no,</if>
            <if test="status != null">status,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="evaTaskId != null">#{evaTaskId},</if>
            <if test="stuNo != null">#{stuNo},</if>
            <if test="status != null">#{status},</if>
         </trim>
    </insert>

    <update id="updateCphStuEvaTaskList" parameterType="CphStuEvaTaskList">
        update cph_stu_eva_task_list
        <trim prefix="SET" suffixOverrides=",">
            <if test="evaTaskId != null">eva_task_id = #{evaTaskId},</if>
            <if test="stuNo != null">stu_no = #{stuNo},</if>
            <if test="status != null">status = #{status},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteCphStuEvaTaskListById" parameterType="Long">
        delete from cph_stu_eva_task_list where id = #{id}
    </delete>

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