<?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.RtStuIdReissueMapper">

    <resultMap type="RtStuIdReissue" id="RtStuIdReissueResult">
        <result property="id"    column="id"    />
        <result property="stuId"    column="stu_id"    />
        <result property="stuName"    column="stu_name"    />
        <result property="stuNo"    column="stu_no"    />
        <result property="photo"    column="photo"    />
        <result property="reason"    column="reason"    />
        <result property="applyTime"    column="apply_time"    />
        <result property="inspectionProgress"    column="inspection_progress"    />
        <result property="counsellorId"    column="counsellor_id"    />
        <result property="counsellorName"    column="counsellor_name"    />
        <result property="remark"    column="remark"    />
        <result property="gender"    column="gender"    />
        <result property="departmentName"    column="department_Name"    />
        <result property="gradeName"    column="grade_name"    />
        <result property="className"    column="class_name"    />
        <result property="mz"    column="mz"    />
        <result property="jg"    column="jg"    />
        <result property="hksz2"    column="hksz2"    />
        <result property="dormitoryNumber"    column="dormitory_number"    />
        <result property="dormitoryBuilding"    column="dormitory_building"    />
        <result property="birthplace"    column="birthplace"    />
        <result property="birthday"    column="birthday"    />
        <result property="phoneNumber"    column="phoneNumber"    />
        <result property="fdyCmt"    column="fdy_cmt"    />
        <result property="jwcCmt"    column="jwc_cmt"    />
        <result property="isPay"    column="is_pay"    />
        <result property="paymentAmount"    column="payment_amount"    />
        <result property="railwayStation"    column="railway_station"    />
        <result property="enrollmentTime"    column="enrollment_time"    />
    </resultMap>

    <sql id="selectRtStuIdReissueVo">
        select id, stu_id, stu_name, stu_no, photo, reason, apply_time, inspection_progress, counsellor_id, counsellor_name, remark, gender, department_Name, grade_name, class_name, mz, jg, hksz2, dormitory_number, dormitory_building, birthplace, birthday, phoneNumber, fdy_cmt, jwc_cmt, is_pay, payment_amount, railway_station, enrollment_time from rt_stu_id_reissue
    </sql>

    <select id="selectRtStuIdReissueList" parameterType="RtStuIdReissue" resultMap="RtStuIdReissueResult">
        <include refid="selectRtStuIdReissueVo"/>
        <where>
            <if test="stuId != null "> and stu_id = #{stuId}</if>
            <if test="stuName != null  and stuName != ''"> and stu_name like concat('%', #{stuName}, '%')</if>
            <if test="stuNo != null  and stuNo != ''"> and stu_no = #{stuNo}</if>
            <if test="photo != null  and photo != ''"> and photo = #{photo}</if>
            <if test="reason != null  and reason != ''"> and reason = #{reason}</if>
            <if test="applyTime != null "> and apply_time = #{applyTime}</if>
            <if test="inspectionProgress != null "> and inspection_progress = #{inspectionProgress}</if>
            <if test="counsellorId != null "> and counsellor_id = #{counsellorId}</if>
            <if test="counsellorName != null  and counsellorName != ''"> and counsellor_name like concat('%', #{counsellorName}, '%')</if>
            <if test="gender != null  and gender != ''"> and gender = #{gender}</if>
            <if test="departmentName != null  and departmentName != ''"> and department_Name like concat('%', #{departmentName}, '%')</if>
            <if test="gradeName != null  and gradeName != ''"> and grade_name like concat('%', #{gradeName}, '%')</if>
            <if test="className != null  and className != ''"> and class_name like concat('%', #{className}, '%')</if>
            <if test="mz != null  and mz != ''"> and mz = #{mz}</if>
            <if test="jg != null  and jg != ''"> and jg = #{jg}</if>
            <if test="hksz2 != null  and hksz2 != ''"> and hksz2 = #{hksz2}</if>
            <if test="dormitoryNumber != null "> and dormitory_number = #{dormitoryNumber}</if>
            <if test="dormitoryBuilding != null  and dormitoryBuilding != ''"> and dormitory_building = #{dormitoryBuilding}</if>
            <if test="birthplace != null  and birthplace != ''"> and birthplace = #{birthplace}</if>
            <if test="birthday != null  and birthday != ''"> and birthday = #{birthday}</if>
            <if test="phoneNumber != null  and phoneNumber != ''"> and phoneNumber = #{phoneNumber}</if>
            <if test="fdyCmt != null  and fdyCmt != ''"> and fdy_cmt = #{fdyCmt}</if>
            <if test="jwcCmt != null  and jwcCmt != ''"> and jwc_cmt = #{jwcCmt}</if>
            <if test="isPay != null "> and is_pay = #{isPay}</if>
            <if test="paymentAmount != null "> and payment_amount = #{paymentAmount}</if>
            <if test="railwayStation != null  and railwayStation != ''"> and railway_station = #{railwayStation}</if>
            <if test="enrollmentTime != null "> and enrollment_time = #{enrollmentTime}</if>
        </where>
    </select>

    <select id="selectRtStuIdReissueById" parameterType="Long" resultMap="RtStuIdReissueResult">
        <include refid="selectRtStuIdReissueVo"/>
        where id = #{id}
    </select>

    <select id="selectRtStuIdReissueByStuNo" parameterType="String" resultMap="RtStuIdReissueResult">
        <include refid="selectRtStuIdReissueVo"/>
        where stu_no = #{stuNo}
    </select>

    <insert id="insertRtStuIdReissue" parameterType="RtStuIdReissue" useGeneratedKeys="true" keyProperty="id">
        insert into rt_stu_id_reissue
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="stuId != null">stu_id,</if>
            <if test="stuName != null and stuName != ''">stu_name,</if>
            <if test="stuNo != null and stuNo != ''">stu_no,</if>
            <if test="photo != null and photo != ''">photo,</if>
            <if test="reason != null and reason != ''">reason,</if>
            <if test="applyTime != null">apply_time,</if>
            <if test="inspectionProgress != null">inspection_progress,</if>
            <if test="counsellorId != null">counsellor_id,</if>
            <if test="counsellorName != null">counsellor_name,</if>
            <if test="remark != null">remark,</if>
            <if test="gender != null">gender,</if>
            <if test="departmentName != null">department_Name,</if>
            <if test="gradeName != null">grade_name,</if>
            <if test="className != null">class_name,</if>
            <if test="mz != null">mz,</if>
            <if test="jg != null">jg,</if>
            <if test="hksz2 != null">hksz2,</if>
            <if test="dormitoryNumber != null">dormitory_number,</if>
            <if test="dormitoryBuilding != null">dormitory_building,</if>
            <if test="birthplace != null">birthplace,</if>
            <if test="birthday != null">birthday,</if>
            <if test="phoneNumber != null">phoneNumber,</if>
            <if test="fdyCmt != null">fdy_cmt,</if>
            <if test="jwcCmt != null">jwc_cmt,</if>
            <if test="isPay != null">is_pay,</if>
            <if test="paymentAmount != null">payment_amount,</if>
            <if test="railwayStation != null">railway_station,</if>
            <if test="enrollmentTime != null">enrollment_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="stuId != null">#{stuId},</if>
            <if test="stuName != null and stuName != ''">#{stuName},</if>
            <if test="stuNo != null and stuNo != ''">#{stuNo},</if>
            <if test="photo != null and photo != ''">#{photo},</if>
            <if test="reason != null and reason != ''">#{reason},</if>
            <if test="applyTime != null">#{applyTime},</if>
            <if test="inspectionProgress != null">#{inspectionProgress},</if>
            <if test="counsellorId != null">#{counsellorId},</if>
            <if test="counsellorName != null">#{counsellorName},</if>
            <if test="remark != null">#{remark},</if>
            <if test="gender != null">#{gender},</if>
            <if test="departmentName != null">#{departmentName},</if>
            <if test="gradeName != null">#{gradeName},</if>
            <if test="className != null">#{className},</if>
            <if test="mz != null">#{mz},</if>
            <if test="jg != null">#{jg},</if>
            <if test="hksz2 != null">#{hksz2},</if>
            <if test="dormitoryNumber != null">#{dormitoryNumber},</if>
            <if test="dormitoryBuilding != null">#{dormitoryBuilding},</if>
            <if test="birthplace != null">#{birthplace},</if>
            <if test="birthday != null">#{birthday},</if>
            <if test="phoneNumber != null">#{phoneNumber},</if>
            <if test="fdyCmt != null">#{fdyCmt},</if>
            <if test="jwcCmt != null">#{jwcCmt},</if>
            <if test="isPay != null">#{isPay},</if>
            <if test="paymentAmount != null">#{paymentAmount},</if>
            <if test="railwayStation != null">#{railwayStation},</if>
            <if test="enrollmentTime != null">#{enrollmentTime},</if>
        </trim>
    </insert>

    <update id="updateRtStuIdReissue" parameterType="RtStuIdReissue">
        update rt_stu_id_reissue
        <trim prefix="SET" suffixOverrides=",">
            <if test="stuId != null">stu_id = #{stuId},</if>
            <if test="stuName != null and stuName != ''">stu_name = #{stuName},</if>
            <if test="stuNo != null and stuNo != ''">stu_no = #{stuNo},</if>
            <if test="photo != null and photo != ''">photo = #{photo},</if>
            <if test="reason != null and reason != ''">reason = #{reason},</if>
            <if test="applyTime != null">apply_time = #{applyTime},</if>
            <if test="inspectionProgress != null">inspection_progress = #{inspectionProgress},</if>
            <if test="counsellorId != null">counsellor_id = #{counsellorId},</if>
            <if test="counsellorName != null">counsellor_name = #{counsellorName},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="gender != null">gender = #{gender},</if>
            <if test="departmentName != null">department_Name = #{departmentName},</if>
            <if test="gradeName != null">grade_name = #{gradeName},</if>
            <if test="className != null">class_name = #{className},</if>
            <if test="mz != null">mz = #{mz},</if>
            <if test="jg != null">jg = #{jg},</if>
            <if test="hksz2 != null">hksz2 = #{hksz2},</if>
            <if test="dormitoryNumber != null">dormitory_number = #{dormitoryNumber},</if>
            <if test="dormitoryBuilding != null">dormitory_building = #{dormitoryBuilding},</if>
            <if test="birthplace != null">birthplace = #{birthplace},</if>
            <if test="birthday != null">birthday = #{birthday},</if>
            <if test="phoneNumber != null">phoneNumber = #{phoneNumber},</if>
            <if test="fdyCmt != null">fdy_cmt = #{fdyCmt},</if>
            <if test="jwcCmt != null">jwc_cmt = #{jwcCmt},</if>
            <if test="isPay != null">is_pay = #{isPay},</if>
            <if test="paymentAmount != null">payment_amount = #{paymentAmount},</if>
            <if test="railwayStation != null">railway_station = #{railwayStation},</if>
            <if test="enrollmentTime != null">enrollment_time = #{enrollmentTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteRtStuIdReissueById" parameterType="Long">
        delete from rt_stu_id_reissue where id = #{id}
    </delete>

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