wms-serve-mule/src/main/resources/mapper/GoodsMapper.xml

75 lines
3.2 KiB
XML
Raw Normal View History

2024-07-04 07:43:04 +08:00
<?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="goodsUnit" column="goods_unit"/>
<result property="lifeDays" column="life_days"/>
<result property="remark" column="remark"/>
<result property="singleWeight" column="single_weight"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
2024-07-04 07:43:04 +08:00
</resultMap>
<sql id="selectAll">
select goods_id, goods_unit, life_days, remark, single_weight,create_time, update_time
2024-07-04 07:43:04 +08:00
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="goodsUnit != null and goodsUnit != ''"> and goods_unit = #{goodsUnit}</if>
<if test="lifeDays != null"> and life_days = #{lifeDays}</if>
<if test="remark != null"> and remark = #{remark}</if>
<if test="singleWeight != null"> and single_weight = #{single_weight}</if>
<if test="updateTime != null"> and update_time = #{updateTime}</if>
<if test="createTime != null"> and create_time = #{create_time}</if>
2024-07-04 07:43:04 +08:00
</where>
order by create_time desc
2024-07-04 07:43:04 +08:00
</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="goodsUnit != null">goods_unit,</if>
<if test="lifeDays != null">life_days,</if>
<if test="remark != null"> remark</if>
<if test="singleWeight != null">single_weight</if>
2024-07-04 07:43:04 +08:00
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="goodsId != null">#{goodsId},</if>
<if test="goodsUnit != null">#{goodsUnit},</if>
<if test="lifeDays != null">#{lifeDays},</if>
<if test="remark != null"> #{remark}</if>
<if test="singleWeight != null">#{singleWeight}</if>
2024-07-04 07:43:04 +08:00
</trim>
</insert>
<update id="modifyGoods" parameterType="Goods">
update tbl_app_goods
<trim prefix="SET" suffixOverrides=",">
<if test="goodsUnit != null">goods_unit = #{goodsUnit},</if>
<if test="lifeDays != null">life_days = #{lifeDays},</if>
<if test="remark != null"> remark= #{remark},</if>
<if test="singleWeight != null">single_weight = #{singleWeight},</if>
2024-07-04 07:43:04 +08:00
</trim>
where goods_id = #{goodsId}
</update>
<delete id="deleteGoods" parameterType="String">
delete from tbl_app_goods where goods_id = #{goodsId}
</delete>
<update id="clearGoodsInfo" parameterType="String">
truncate table tbl_app_goods
</update>
2024-07-04 07:43:04 +08:00
</mapper>