Files
zhwl/zhwl-wcsc/target/classes/mapper/wcsc/ZdyWcscGoodsSkuPriceMapper.xml
2025-07-01 17:54:58 +08:00

282 lines
9.6 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.zhwl.wcsc.mapper.ZdyWcscGoodsSkuPriceMapper">
<resultMap type="ZdyWcscGoodsSkuPrice" id="ZdyWcscGoodsSkuPriceResult">
<result property="id" column="id"/>
<result property="goodsSkuIds" column="goods_sku_ids"/>
<result property="goodsId" column="goods_id"/>
<result property="weigh" column="weigh"/>
<result property="image" column="image"/>
<result property="stock" column="stock"/>
<result property="sales" column="sales"/>
<result property="sn" column="sn"/>
<result property="weight" column="weight"/>
<result property="price" column="price"/>
<result property="goodsSkuText" column="goods_sku_text"/>
<result property="status" column="status"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="deletetime" column="deletetime"/>
<result property="createBy" column="create_by"/>
<result property="updateBy" column="update_by"/>
</resultMap>
<sql id="selectZdyWcscGoodsSkuPriceVo">
select id,
goods_sku_ids,
goods_id,
weigh,
image,
stock,
sales,
sn,
weight,
price,
goods_sku_text,
status,
create_time,
update_time,
deletetime,
create_by,
update_by
from zdy_wcsc_goods_sku_price
</sql>
<select id="selectZdyWcscGoodsSkuPriceList" parameterType="ZdyWcscGoodsSkuPrice"
resultMap="ZdyWcscGoodsSkuPriceResult">
<include refid="selectZdyWcscGoodsSkuPriceVo"/>
<where>
<if test="goodsSkuIds != null and goodsSkuIds != ''">
and goods_sku_ids = #{goodsSkuIds}
</if>
<if test="goodsId != null ">
and goods_id = #{goodsId}
</if>
<if test="weigh != null ">
and weigh = #{weigh}
</if>
<if test="image != null and image != ''">
and image = #{image}
</if>
<if test="stock != null ">
and stock = #{stock}
</if>
<if test="sales != null ">
and sales = #{sales}
</if>
<if test="sn != null and sn != ''">
and sn = #{sn}
</if>
<if test="weight != null ">
and weight = #{weight}
</if>
<if test="price != null ">
and price = #{price}
</if>
<if test="goodsSkuText != null and goodsSkuText != ''">
and goods_sku_text = #{goodsSkuText}
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
<if test="deletetime != null ">
and deletetime = #{deletetime}
</if>
</where>
</select>
<select id="selectZdyWcscGoodsSkuPriceById" parameterType="Long"
resultMap="ZdyWcscGoodsSkuPriceResult">
<include refid="selectZdyWcscGoodsSkuPriceVo"/>
where id = #{id}
</select>
<insert id="insertZdyWcscGoodsSkuPrice" parameterType="ZdyWcscGoodsSkuPrice" useGeneratedKeys="true"
keyProperty="id">
insert into zdy_wcsc_goods_sku_price
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="goodsSkuIds != null">goods_sku_ids,
</if>
<if test="goodsId != null">goods_id,
</if>
<if test="weigh != null">weigh,
</if>
<if test="image != null">image,
</if>
<if test="stock != null">stock,
</if>
<if test="sales != null">sales,
</if>
<if test="sn != null">sn,
</if>
<if test="weight != null">weight,
</if>
<if test="price != null">price,
</if>
<if test="goodsSkuText != null">goods_sku_text,
</if>
<if test="status != null">status,
</if>
<if test="createTime != null">create_time,
</if>
<if test="updateTime != null">update_time,
</if>
<if test="deletetime != null">deletetime,
</if>
<if test="createBy != null">create_by,
</if>
<if test="updateBy != null">update_by,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="goodsSkuIds != null">#{goodsSkuIds},
</if>
<if test="goodsId != null">#{goodsId},
</if>
<if test="weigh != null">#{weigh},
</if>
<if test="image != null">#{image},
</if>
<if test="stock != null">#{stock},
</if>
<if test="sales != null">#{sales},
</if>
<if test="sn != null">#{sn},
</if>
<if test="weight != null">#{weight},
</if>
<if test="price != null">#{price},
</if>
<if test="goodsSkuText != null">#{goodsSkuText},
</if>
<if test="status != null">#{status},
</if>
<if test="createTime != null">#{createTime},
</if>
<if test="updateTime != null">#{updateTime},
</if>
<if test="deletetime != null">#{deletetime},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="updateBy != null">#{updateBy},
</if>
</trim>
</insert>
<update id="updateZdyWcscGoodsSkuPrice" parameterType="ZdyWcscGoodsSkuPrice">
update zdy_wcsc_goods_sku_price
<trim prefix="SET" suffixOverrides=",">
<if test="goodsSkuIds != null">goods_sku_ids =
#{goodsSkuIds},
</if>
<if test="goodsId != null">goods_id =
#{goodsId},
</if>
<if test="weigh != null">weigh =
#{weigh},
</if>
<if test="image != null">image =
#{image},
</if>
<if test="stock != null">stock =
#{stock},
</if>
<if test="sales != null">sales =
#{sales},
</if>
<if test="sn != null">sn =
#{sn},
</if>
<if test="weight != null">weight =
#{weight},
</if>
<if test="price != null">price =
#{price},
</if>
<if test="goodsSkuText != null">goods_sku_text =
#{goodsSkuText},
</if>
<if test="status != null">status =
#{status},
</if>
<if test="createTime != null">create_time =
#{createTime},
</if>
<if test="updateTime != null">update_time =
#{updateTime},
</if>
deletetime = #{deletetime},
<if test="createBy != null">create_by =
#{createBy},
</if>
<if test="updateBy != null">update_by =
#{updateBy},
</if>
</trim>
where id = #{id}
</update>
<delete id="deleteZdyWcscGoodsSkuPriceById" parameterType="Long">
delete
from zdy_wcsc_goods_sku_price
where id = #{id}
</delete>
<delete id="deleteZdyWcscGoodsSkuPriceByIds" parameterType="String">
delete from zdy_wcsc_goods_sku_price where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteZdyWcscGoodsSkuPriceByGoodsId" parameterType="Long">
update zdy_wcsc_goods_sku_price
set deletetime = sysdate()
where goods_id = #{goodsId}
</delete>
<delete id="deleteZdyWcscGoodsSkuPriceByGoodsIds" parameterType="String">
update zdy_wcsc_goods_sku_price set deletetime = sysdate()
where goods_id in
<foreach item="goodsId" collection="array" open="(" separator="," close=")">
#{goodsId}
</foreach>
</delete>
<select id="selectZdyWcscGoodsSkuPriceByGoodsId" parameterType="Long"
resultMap="ZdyWcscGoodsSkuPriceResult">
<include refid="selectZdyWcscGoodsSkuPriceVo"/>
where goods_id = #{goodsId} and ISNULL(deletetime)
</select>
<update id="updateStock" parameterType="ZdyWcscGoodsSkuPrice">
update zdy_wcsc_goods_sku_price
set stock = stock + #{stock},sales = sales - #{stock}
where id = #{id}
</update>
<update id="reduceSkuStock" parameterType="java.util.Map">
update zdy_wcsc_goods_sku_price
set stock = stock - #{stock},sales = sales + #{stock}
where id = #{id}
and stock >= #{stock}
</update>
<update id="deleteByStoreIds">
UPDATE zdy_wcsc_goods_sku_price
SET deletetime = SYSDATE()
WHERE EXISTS (
SELECT 1
FROM zdy_wcsc_goods
WHERE zdy_wcsc_goods.id = zdy_wcsc_goods_sku_price.goods_id
AND zdy_wcsc_goods.store_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
)
AND zdy_wcsc_goods_sku_price.deletetime IS NULL;
</update>
</mapper>