98 lines
5.3 KiB
XML
98 lines
5.3 KiB
XML
|
|
<?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.wms.mapper.GoodsMapper">
|
||
|
|
<resultMap type="Goods" id="GoodsMap">
|
||
|
|
<result property="goodsId" column="goods_id"/>
|
||
|
|
<result property="goodsName" column="goods_name"/>
|
||
|
|
<result property="goodsUnit" column="goods_unit"/>
|
||
|
|
<result property="itemId" column="item_id"/>
|
||
|
|
<result property="itemType" column="item_type"/>
|
||
|
|
<result property="invCategory" column="inv_category"/>
|
||
|
|
<result property="lifeDays" column="life_days"/>
|
||
|
|
<result property="organizationId" column="organization_id"/>
|
||
|
|
<result property="organizationCode" column="organization_code"/>
|
||
|
|
<result property="lastUpdateTime" column="last_update_time"/>
|
||
|
|
<result property="lastUpdateUser" column="last_update_user"/>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectAll">
|
||
|
|
select goods_id, goods_name, goods_unit, item_id, item_type, inv_category, life_days, organization_id,
|
||
|
|
organization_code, last_update_time, last_update_user
|
||
|
|
from tbl_app_goods
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selGoods" parameterType="Goods" resultMap="GoodsMap">
|
||
|
|
<include refid="selectAll"/>
|
||
|
|
<where>
|
||
|
|
<if test="goodsId != null and goodsId != ''"> and goods_id = #{goodsId}</if>
|
||
|
|
<if test="goodsName != null and goodsName != ''"> and goods_name = #{goodsName}</if>
|
||
|
|
<if test="goodsUnit != null and goodsUnit != ''"> and goods_unit = #{goodsUnit}</if>
|
||
|
|
<if test="itemId != null and itemId != ''"> and item_id = #{itemId}</if>
|
||
|
|
<if test="itemType != null and goodsId != ''"> and item_type = #{itemType}</if>
|
||
|
|
<if test="invCategory != null and invCategory != ''"> and inv_category = #{invCategory}</if>
|
||
|
|
<if test="lifeDays != null"> and life_days = #{lifeDays}</if>
|
||
|
|
<if test="organizationId != null and organizationId != ''"> and organization_id = #{organizationId}</if>
|
||
|
|
<if test="organizationCode != null and organizationCode != ''"> and organization_code = #{organizationCode}</if>
|
||
|
|
<if test="lastUpdateTime != null"> and last_update_time = #{lastUpdateTime}</if>
|
||
|
|
<if test="lastUpdateUser != null and lastUpdateUser != ''"> and last_update_user = #{lastUpdateUser}</if>
|
||
|
|
</where>
|
||
|
|
order by last_update_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selGoodsByGoodsId" parameterType="String" resultMap="GoodsMap">
|
||
|
|
<include refid="selectAll"/>
|
||
|
|
where goods_id = #{goodsId};
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="addGoods" parameterType="Goods">
|
||
|
|
insert into tbl_app_goods
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="goodsId != null">goods_id,</if>
|
||
|
|
<if test="goodsName != null">goods_name,</if>
|
||
|
|
<if test="goodsUnit != null">goods_unit,</if>
|
||
|
|
<if test="itemId != null">item_id,</if>
|
||
|
|
<if test="itemType != null">item_type,</if>
|
||
|
|
<if test="invCategory != null">inv_category,</if>
|
||
|
|
<if test="lifeDays != null">life_days,</if>
|
||
|
|
<if test="organizationId != null">organization_id,</if>
|
||
|
|
<if test="organizationCode != null">organization_code,</if>
|
||
|
|
<if test="lastUpdateTime != null">last_update_time,</if>
|
||
|
|
<if test="lastUpdateUser != null">last_update_user,</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="itemId != null">#{itemId},</if>
|
||
|
|
<if test="itemType != null">#{itemType},</if>
|
||
|
|
<if test="invCategory != null">#{invCategory},</if>
|
||
|
|
<if test="lifeDays != null">#{lifeDays},</if>
|
||
|
|
<if test="organizationId != null">#{organizationId},</if>
|
||
|
|
<if test="organizationCode != null">#{organizationCode},</if>
|
||
|
|
<if test="lastUpdateTime != null">#{lastUpdateTime},</if>
|
||
|
|
<if test="lastUpdateUser != null">#{lastUpdateUser},</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="modifyGoods" parameterType="Goods">
|
||
|
|
update tbl_app_goods
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="goodsName != null">goods_name = #{goodsName},</if>
|
||
|
|
<if test="goodsUnit != null">goods_unit = #{goodsUnit},</if>
|
||
|
|
<if test="itemId != null">item_id = #{itemId},</if>
|
||
|
|
<if test="itemType != null">item_type = #{itemType},</if>
|
||
|
|
<if test="invCategory != null">inv_category = #{invCategory},</if>
|
||
|
|
<if test="lifeDays != null">life_days = #{lifeDays},</if>
|
||
|
|
<if test="organizationId != null">organization_id = #{organizationId},</if>
|
||
|
|
<if test="organizationCode != null">organization_code = #{organizationCode},</if>
|
||
|
|
<if test="lastUpdateTime != null">last_update_time = #{lastUpdateTime},</if>
|
||
|
|
<if test="lastUpdateUser != null">last_update_user = #{lastUpdateUser},</if>
|
||
|
|
</trim>
|
||
|
|
where goods_id = #{goodsId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteGoods" parameterType="String">
|
||
|
|
delete from tbl_app_goods where goods_id = #{goodsId}
|
||
|
|
</delete>
|
||
|
|
</mapper>
|