<?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.workstudy.mapper.QgzxMoneyExtraMapper">
    
    <resultMap type="QgzxMoneyExtra" id="QgzxMoneyExtraResult">
        <result property="id"    column="id"    />
        <result property="stuNo"    column="stu_no"    />
        <result property="postName"    column="post_name"    />
        <result property="deptCode"    column="dept_code"    />
        <result property="postType"    column="post_type"    />
        <result property="zdlsNo"    column="zdls_no"    />
        <result property="totalTime"    column="total_time"    />
        <result property="famliyCondition"    column="famliy_condition"    />
        <result property="zdlsSign"    column="zdls_sign"    />
        <result property="finalSign"    column="final_sign"    />
        <result property="finalTime"    column="final_time"    />
    </resultMap>

    <sql id="selectQgzxMoneyExtraVo">
        select id, stu_no, post_name, dept_code, post_type, zdls_no, total_time, famliy_condition, zdls_sign, final_sign, final_time from qgzx_money_extra
    </sql>

    <select id="selectQgzxMoneyExtraList" parameterType="QgzxMoneyExtra" resultMap="QgzxMoneyExtraResult">
        <include refid="selectQgzxMoneyExtraVo"/>
        <where>  
            <if test="stuNo != null  and stuNo != ''"> and stu_no = #{stuNo}</if>
            <if test="postName != null  and postName != ''"> and post_name like concat('%', #{postName}, '%')</if>
            <if test="deptCode != null  and deptCode != ''"> and dept_code = #{deptCode}</if>
            <if test="postType != null  and postType != ''"> and post_type = #{postType}</if>
            <if test="zdlsNo != null  and zdlsNo != ''"> and zdls_no = #{zdlsNo}</if>
            <if test="totalTime != null "> and total_time = #{totalTime}</if>
            <if test="famliyCondition != null  and famliyCondition != ''"> and famliy_condition = #{famliyCondition}</if>
            <if test="zdlsSign != null  and zdlsSign != ''"> and zdls_sign = #{zdlsSign}</if>
            <if test="finalSign != null  and finalSign != ''"> and final_sign = #{finalSign}</if>
            <if test="finalTime != null "> and final_time = #{finalTime}</if>
        </where>
    </select>
    
    <select id="selectQgzxMoneyExtraById" parameterType="Long" resultMap="QgzxMoneyExtraResult">
        <include refid="selectQgzxMoneyExtraVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertQgzxMoneyExtra" parameterType="QgzxMoneyExtra" useGeneratedKeys="true" keyProperty="id">
        insert into qgzx_money_extra
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="stuNo != null">stu_no,</if>
            <if test="postName != null">post_name,</if>
            <if test="deptCode != null">dept_code,</if>
            <if test="postType != null">post_type,</if>
            <if test="zdlsNo != null">zdls_no,</if>
            <if test="totalTime != null">total_time,</if>
            <if test="famliyCondition != null">famliy_condition,</if>
            <if test="zdlsSign != null">zdls_sign,</if>
            <if test="finalSign != null">final_sign,</if>
            <if test="finalTime != null">final_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="stuNo != null">#{stuNo},</if>
            <if test="postName != null">#{postName},</if>
            <if test="deptCode != null">#{deptCode},</if>
            <if test="postType != null">#{postType},</if>
            <if test="zdlsNo != null">#{zdlsNo},</if>
            <if test="totalTime != null">#{totalTime},</if>
            <if test="famliyCondition != null">#{famliyCondition},</if>
            <if test="zdlsSign != null">#{zdlsSign},</if>
            <if test="finalSign != null">#{finalSign},</if>
            <if test="finalTime != null">#{finalTime},</if>
         </trim>
    </insert>

    <update id="updateQgzxMoneyExtra" parameterType="QgzxMoneyExtra">
        update qgzx_money_extra
        <trim prefix="SET" suffixOverrides=",">
            <if test="stuNo != null">stu_no = #{stuNo},</if>
            <if test="postName != null">post_name = #{postName},</if>
            <if test="deptCode != null">dept_code = #{deptCode},</if>
            <if test="postType != null">post_type = #{postType},</if>
            <if test="zdlsNo != null">zdls_no = #{zdlsNo},</if>
            <if test="totalTime != null">total_time = #{totalTime},</if>
            <if test="famliyCondition != null">famliy_condition = #{famliyCondition},</if>
            <if test="zdlsSign != null">zdls_sign = #{zdlsSign},</if>
            <if test="finalSign != null">final_sign = #{finalSign},</if>
            <if test="finalTime != null">final_time = #{finalTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteQgzxMoneyExtraById" parameterType="Long">
        delete from qgzx_money_extra where id = #{id}
    </delete>

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