<?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.bonus.material.settlement.mapper.SltProjectMonthMapper">
    <resultMap type="com.bonus.material.settlement.domain.SltProjectMonth" id="SltProjectMonthResult">
        <result property="id"    column="id"    />
        <result property="month"    column="month"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectSltProjectMonthVo">
        select id, month, create_time, update_time from slt_project_month
    </sql>

    <select id="selectSltProjectMonthList" parameterType="com.bonus.material.settlement.domain.SltProjectMonth" resultMap="SltProjectMonthResult">
        <include refid="selectSltProjectMonthVo"/>
        <where>  
            <if test="month != null  and month != ''"> and month = #{month}</if>
        </where>
    </select>
    
    <select id="selectSltProjectMonthById" parameterType="Long" resultMap="SltProjectMonthResult">
        <include refid="selectSltProjectMonthVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertSltProjectMonth" parameterType="com.bonus.material.settlement.domain.SltProjectMonth" useGeneratedKeys="true" keyProperty="id">
        insert into slt_project_month
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="month != null">month,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="month != null">#{month},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateSltProjectMonth" parameterType="com.bonus.material.settlement.domain.SltProjectMonth">
        update slt_project_month
        <trim prefix="SET" suffixOverrides=",">
            <if test="month != null">month = #{month},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSltProjectMonthById" parameterType="Long">
        delete from slt_project_month where id = #{id}
    </delete>

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