<?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.ma.mapper.TypePutInStorageInfoMapper">
    <resultMap type="com.bonus.material.ma.domain.TypePutInStorageInfo" id="TypePutInStorageInfoResult">
        <result property="ID"    column="ID"    />
        <result property="putInType"    column="PUT_IN_TYPE"    />
        <result property="NUM"    column="NUM"    />
        <result property="CREATOR"    column="CREATOR"    />
        <result property="CODE"    column="CODE"    />
        <result property="unitId"    column="UNIT_ID"    />
        <result property="projectId"    column="PROJECT_ID"    />
        <result property="createDate"    column="CREATE_DATE"    />
        <result property="REMARKS"    column="REMARKS"    />
        <result property="TYPE"    column="TYPE"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectTypePutInStorageInfoVo">
        select ID, PUT_IN_TYPE, NUM, CREATOR, CODE, UNIT_ID, PROJECT_ID, CREATE_DATE, REMARKS, TYPE, create_time, update_time from ma_type_put_in_storage_info
    </sql>

    <select id="selectTypePutInStorageInfoList" parameterType="com.bonus.material.ma.domain.TypePutInStorageInfo" resultMap="TypePutInStorageInfoResult">
        <include refid="selectTypePutInStorageInfoVo"/>
        <where>  
            <if test="putInType != null  and putInType != ''"> and PUT_IN_TYPE = #{putInType}</if>
            <if test="NUM != null "> and NUM = #{NUM}</if>
            <if test="CREATOR != null "> and CREATOR = #{CREATOR}</if>
            <if test="CODE != null  and CODE != ''"> and CODE = #{CODE}</if>
            <if test="unitId != null  and unitId != ''"> and UNIT_ID = #{unitId}</if>
            <if test="projectId != null  and projectId != ''"> and PROJECT_ID = #{projectId}</if>
            <if test="createDate != null  and createDate != ''"> and CREATE_DATE = #{createDate}</if>
            <if test="REMARKS != null  and REMARKS != ''"> and REMARKS = #{REMARKS}</if>
            <if test="TYPE != null "> and TYPE = #{TYPE}</if>
        </where>
    </select>
    
    <select id="selectTypePutInStorageInfoByID" parameterType="Long" resultMap="TypePutInStorageInfoResult">
        <include refid="selectTypePutInStorageInfoVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTypePutInStorageInfo" parameterType="com.bonus.material.ma.domain.TypePutInStorageInfo" useGeneratedKeys="true" keyProperty="ID">
        insert into ma_type_put_in_storage_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="putInType != null">PUT_IN_TYPE,</if>
            <if test="NUM != null">NUM,</if>
            <if test="CREATOR != null">CREATOR,</if>
            <if test="CODE != null">CODE,</if>
            <if test="unitId != null">UNIT_ID,</if>
            <if test="projectId != null">PROJECT_ID,</if>
            <if test="createDate != null">CREATE_DATE,</if>
            <if test="REMARKS != null">REMARKS,</if>
            <if test="TYPE != null">TYPE,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="putInType != null">#{putInType},</if>
            <if test="NUM != null">#{NUM},</if>
            <if test="CREATOR != null">#{CREATOR},</if>
            <if test="CODE != null">#{CODE},</if>
            <if test="unitId != null">#{unitId},</if>
            <if test="projectId != null">#{projectId},</if>
            <if test="createDate != null">#{createDate},</if>
            <if test="REMARKS != null">#{REMARKS},</if>
            <if test="TYPE != null">#{TYPE},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateTypePutInStorageInfo" parameterType="com.bonus.material.ma.domain.TypePutInStorageInfo">
        update ma_type_put_in_storage_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="putInType != null">PUT_IN_TYPE = #{putInType},</if>
            <if test="NUM != null">NUM = #{NUM},</if>
            <if test="CREATOR != null">CREATOR = #{CREATOR},</if>
            <if test="CODE != null">CODE = #{CODE},</if>
            <if test="unitId != null">UNIT_ID = #{unitId},</if>
            <if test="projectId != null">PROJECT_ID = #{projectId},</if>
            <if test="createDate != null">CREATE_DATE = #{createDate},</if>
            <if test="REMARKS != null">REMARKS = #{REMARKS},</if>
            <if test="TYPE != null">TYPE = #{TYPE},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where ID = #{ID}
    </update>

    <delete id="deleteTypePutInStorageInfoByID" parameterType="Long">
        delete from ma_type_put_in_storage_info where ID = #{ID}
    </delete>

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