<?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.yunfeiyun.agmp.fms.mapper.WmsGoodsMapper">
    
    <resultMap type="WmsGoods" id="WmsGoodsResult">
        <result property="goodsId"    column="goodsId"    />
        <result property="goodsName"    column="goodsName"    />
        <result property="goodsUnit"    column="goodsUnit"    />
        <result property="goodsSpec"    column="goodsSpec"    />
    </resultMap>


        
    <insert id="insertWmsGoods" parameterType="WmsGoods">
        insert into WmsGoods
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="goodsId != null">goodsId,</if>
            <if test="goodsName != null">goodsName,</if>
            <if test="goodsUnit != null">goodsUnit,</if>
            <if test="goodsSpec != null">goodsSpec,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="goodsId != null">#{goodsId},</if>
            <if test="goodsName != null">#{goodsName},</if>
            <if test="goodsUnit != null">#{goodsUnit},</if>
            <if test="goodsSpec != null">#{goodsSpec},</if>
         </trim>
    </insert>

    <update id="updateWmsGoods" parameterType="WmsGoods">
        update WmsGoods
        <trim prefix="SET" suffixOverrides=",">
            <if test="goodsName != null">goodsName = #{goodsName},</if>
            <if test="goodsUnit != null ">  goodsUnit = #{goodsUnit}</if>
            <if test="goodsSpec != null ">  goodsSpec = #{goodsSpec}</if>
        </trim>
        where goodsId = #{goodsId}
    </update>

    <delete id="deleteWmsGoodsByGoodsId" parameterType="String">
        delete from WmsGoods where goodsId = #{goodsId}
    </delete>

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