<?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.routine.mapper.RtClassMettingStuUploadMapper">
    
    <resultMap type="RtClassMettingStuUpload" id="RtClassMettingStuUploadResult">
        <result property="id"    column="id"    />
        <result property="stuNo"    column="stu_no"    />
        <result property="tNo"    column="t_no"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectRtClassMettingStuUploadVo">
        select id, stu_no, t_no, create_time, create_by, update_time, update_by from rt_class_metting_stu_upload
    </sql>

    <select id="selectRtClassMettingStuUploadList" parameterType="RtClassMettingStuUpload" resultMap="RtClassMettingStuUploadResult">
        <include refid="selectRtClassMettingStuUploadVo"/>
        <where>  
            <if test="stuNo != null  and stuNo != ''"> and stu_no = #{stuNo}</if>
            <if test="tNo != null  and tNo != ''"> and t_no = #{tNo}</if>
        </where>
    </select>
    
    <select id="selectRtClassMettingStuUploadById" parameterType="Long" resultMap="RtClassMettingStuUploadResult">
        <include refid="selectRtClassMettingStuUploadVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertRtClassMettingStuUpload" parameterType="RtClassMettingStuUpload" useGeneratedKeys="true" keyProperty="id">
        insert into rt_class_metting_stu_upload
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="stuNo != null">stu_no,</if>
            <if test="tNo != null">t_no,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="stuNo != null">#{stuNo},</if>
            <if test="tNo != null">#{tNo},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
         </trim>
    </insert>

    <update id="updateRtClassMettingStuUpload" parameterType="RtClassMettingStuUpload">
        update rt_class_metting_stu_upload
        <trim prefix="SET" suffixOverrides=",">
            <if test="stuNo != null">stu_no = #{stuNo},</if>
            <if test="tNo != null">t_no = #{tNo},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteRtClassMettingStuUploadById" parameterType="Long">
        delete from rt_class_metting_stu_upload where id = #{id}
    </delete>

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

    <select id="listFdyStuUpload" resultType="map" parameterType="String">
        select a.*,b.stu_name,b.class_name
        from rt_class_metting_stu_upload as a
                 left join view_stu_info as b on a.stu_no = b.stu_no
        where b.t_no = #{tNo}
    </select>

    <select id="listStuClass" resultType="map" parameterType="String">
        select a.* from view_stu_info as a where  a.stu_no = #{stuNo}
    </select>

</mapper>