<?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.goldenwater.slaj.eme.mapper.BusiSuppliesReserveMapper">
    <resultMap type="com.goldenwater.slaj.eme.domain.BusiSuppliesReserve" id="BusiSuppliesReserveResult">
        <result property="guid" column="guid"/>
        <result property="orgGuid" column="org_guid"/>
        <result property="suppType" column="supp_type"/>
        <result property="suppCode" column="supp_code"/>
        <result property="suppName" column="supp_name"/>
        <result property="suppSpec" column="supp_spec"/>
        <result property="suppAmount" column="supp_amount"/>
        <result property="suppUnit" column="supp_unit"/>
        <result property="note" column="note"/>
        <result property="createTime" column="create_time"/>
        <result property="creater" column="creater"/>
        <result property="editTime" column="edit_time"/>
        <result property="editer" column="editer"/>
        <result property="distDate" column="dist_date"/>
        <result property="manaOrgGuid" column="mana_org_guid"/>
        <result property="suppContType" column="supp_cont_type"/>
        <result property="suppStatus" column="supp_status"/>
        <result property="storCond" column="stor_cond"/>
        <result property="manaPers" column="mana_pers"/>
        <result property="manaPersTel" column="mana_pers_tel"/>
    </resultMap>
    <sql id="selectBusiSuppliesReserveVo">
        select guid, org_guid, supp_type, supp_code, supp_name, supp_spec,
               supp_amount, supp_unit, note, create_time, creater,
               edit_time, editer, dist_date, mana_org_guid, supp_cont_type,
               supp_status, stor_cond, mana_pers, mana_pers_tel
        from t_busi_supplies_reserve
    </sql>
    <select id="selectBusiSuppliesReserveByGuid" parameterType="String" resultMap="BusiSuppliesReserveResult">
        <include refid="selectBusiSuppliesReserveVo"/>
        where guid = #{guid}
    </select>
    <select id="selectBusiSuppliesReserveList" parameterType="com.goldenwater.slaj.eme.domain.BusiSuppliesReserve" resultMap="BusiSuppliesReserveResult">
        <include refid="selectBusiSuppliesReserveVo"/>
        <where>
            <if test="suppName != null and suppName != ''">AND supp_name like concat('%', #{suppName}, '%')</if>
            <if test="suppType != null and suppType != ''">AND supp_type = #{suppType}</if>
            <if test="suppStatus != null and suppStatus != ''">AND supp_status = #{suppStatus}</if>
            <if test="orgGuid != null and orgGuid != ''">AND org_guid = #{orgGuid}</if>
        </where>
    </select>
    <insert id="insertBusiSuppliesReserve" parameterType="com.goldenwater.slaj.eme.domain.BusiSuppliesReserve">
        insert into t_busi_supplies_reserve (
            guid, org_guid, supp_type, supp_code, supp_name, supp_spec,
            supp_amount, supp_unit, note, create_time, creater,
            edit_time, editer, dist_date, mana_org_guid, supp_cont_type,
            supp_status, stor_cond, mana_pers, mana_pers_tel
        ) values (
            #{guid}, #{orgGuid}, #{suppType}, #{suppCode}, #{suppName}, #{suppSpec},
            #{suppAmount}, #{suppUnit}, #{note}, #{createTime}, #{creater},
            #{editTime}, #{editer}, #{distDate}, #{manaOrgGuid}, #{suppContType},
            #{suppStatus}, #{storCond}, #{manaPers}, #{manaPersTel}
        )
    </insert>
    <update id="updateBusiSuppliesReserve" parameterType="com.goldenwater.slaj.eme.domain.BusiSuppliesReserve">
        update t_busi_supplies_reserve
        <set>
            <if test="orgGuid != null">org_guid = #{orgGuid},</if>
            <if test="suppType != null">supp_type = #{suppType},</if>
            <if test="suppCode != null">supp_code = #{suppCode},</if>
            <if test="suppName != null">supp_name = #{suppName},</if>
            <if test="suppSpec != null">supp_spec = #{suppSpec},</if>
            <if test="suppAmount != null">supp_amount = #{suppAmount},</if>
            <if test="suppUnit != null">supp_unit = #{suppUnit},</if>
            <if test="note != null">note = #{note},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="creater != null">creater = #{creater},</if>
            <if test="editTime != null">edit_time = #{editTime},</if>
            <if test="editer != null">editer = #{editer},</if>
            <if test="distDate != null">dist_date = #{distDate},</if>
            <if test="manaOrgGuid != null">mana_org_guid = #{manaOrgGuid},</if>
            <if test="suppContType != null">supp_cont_type = #{suppContType},</if>
            <if test="suppStatus != null">supp_status = #{suppStatus},</if>
            <if test="storCond != null">stor_cond = #{storCond},</if>
            <if test="manaPers != null">mana_pers = #{manaPers},</if>
            <if test="manaPersTel != null">mana_pers_tel = #{manaPersTel},</if>
        </set>
        where guid = #{guid}
    </update>
    <delete id="deleteBusiSuppliesReserveByGuid" parameterType="String">
        delete from t_busi_supplies_reserve where guid = #{guid}
    </delete>
    <delete id="deleteBusiSuppliesReserveByGuids" parameterType="String">
        delete from t_busi_supplies_reserve where guid in
        <foreach item="guid" collection="array" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </delete>
</mapper>
