<?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.TypePutInStorageDetailsMapper">
    <resultMap type="com.bonus.material.ma.domain.TypePutInStorageDetails" id="TypePutInStorageDetailsResult">
        <result property="ID"    column="ID"    />
        <result property="INFO"    column="INFO"    />
        <result property="NUM"    column="NUM"    />
        <result property="RAM"    column="RAM"    />
        <result property="TYPE"    column="TYPE"    />
        <result property="MACODE"    column="MACODE"    />
        <result property="MACHINE"    column="MACHINE"    />
        <result property="REMARKS"    column="REMARKS"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectTypePutInStorageDetailsVo">
        select ID, INFO, NUM, RAM, TYPE, MACODE, MACHINE, REMARKS, create_time, update_time from ma_type_put_in_storage_details
    </sql>

    <select id="selectTypePutInStorageDetailsList" parameterType="com.bonus.material.ma.domain.TypePutInStorageDetails" resultMap="TypePutInStorageDetailsResult">
        <include refid="selectTypePutInStorageDetailsVo"/>
        <where>  
            <if test="INFO != null "> and INFO = #{INFO}</if>
            <if test="NUM != null "> and NUM = #{NUM}</if>
            <if test="RAM != null "> and RAM = #{RAM}</if>
            <if test="TYPE != null "> and TYPE = #{TYPE}</if>
            <if test="MACODE != null  and MACODE != ''"> and MACODE = #{MACODE}</if>
            <if test="MACHINE != null "> and MACHINE = #{MACHINE}</if>
            <if test="REMARKS != null  and REMARKS != ''"> and REMARKS = #{REMARKS}</if>
        </where>
    </select>
    
    <select id="selectTypePutInStorageDetailsByID" parameterType="Long" resultMap="TypePutInStorageDetailsResult">
        <include refid="selectTypePutInStorageDetailsVo"/>
        where ID = #{ID}
    </select>
        
    <insert id="insertTypePutInStorageDetails" parameterType="com.bonus.material.ma.domain.TypePutInStorageDetails" useGeneratedKeys="true" keyProperty="ID">
        insert into ma_type_put_in_storage_details
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="INFO != null">INFO,</if>
            <if test="NUM != null">NUM,</if>
            <if test="RAM != null">RAM,</if>
            <if test="TYPE != null">TYPE,</if>
            <if test="MACODE != null">MACODE,</if>
            <if test="MACHINE != null">MACHINE,</if>
            <if test="REMARKS != null">REMARKS,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="INFO != null">#{INFO},</if>
            <if test="NUM != null">#{NUM},</if>
            <if test="RAM != null">#{RAM},</if>
            <if test="TYPE != null">#{TYPE},</if>
            <if test="MACODE != null">#{MACODE},</if>
            <if test="MACHINE != null">#{MACHINE},</if>
            <if test="REMARKS != null">#{REMARKS},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateTypePutInStorageDetails" parameterType="com.bonus.material.ma.domain.TypePutInStorageDetails">
        update ma_type_put_in_storage_details
        <trim prefix="SET" suffixOverrides=",">
            <if test="INFO != null">INFO = #{INFO},</if>
            <if test="NUM != null">NUM = #{NUM},</if>
            <if test="RAM != null">RAM = #{RAM},</if>
            <if test="TYPE != null">TYPE = #{TYPE},</if>
            <if test="MACODE != null">MACODE = #{MACODE},</if>
            <if test="MACHINE != null">MACHINE = #{MACHINE},</if>
            <if test="REMARKS != null">REMARKS = #{REMARKS},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where ID = #{ID}
    </update>

    <delete id="deleteTypePutInStorageDetailsByID" parameterType="Long">
        delete from ma_type_put_in_storage_details where ID = #{ID}
    </delete>

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