90 lines
3.2 KiB
XML
90 lines
3.2 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">
|
|
<!--suppress MybatisPlusMapperXmlInspection -->
|
|
<mapper namespace="com.wzj.soopin.goods.mapper.SkuMapper">
|
|
|
|
<resultMap type="Sku" id="SkuResult">
|
|
<result property="id" column="id"/>
|
|
<result property="productId" column="product_id"/>
|
|
<result property="outSkuId" column="out_sku_id"/>
|
|
<result property="price" column="price"/>
|
|
<result property="pic" column="pic"/>
|
|
<result property="spData" column="sp_data"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time" />
|
|
</resultMap>
|
|
|
|
<sql id="selectSkuVo">
|
|
select id, product_id, out_sku_id, price, pic, sp_data, create_by, create_time, update_by, update_time from pms_sku
|
|
</sql>
|
|
<update id="updateStockById">
|
|
update
|
|
pms_sku
|
|
set
|
|
stock = stock - #{quantity},
|
|
update_time = #{optDate}
|
|
where id = #{skuId}
|
|
</update>
|
|
|
|
<select id="selectByEntity" parameterType="Sku" resultMap="SkuResult">
|
|
<include refid="selectSkuVo"/>
|
|
<where>
|
|
<if test="productId != null "> and product_id = #{productId}</if>
|
|
<if test="outSkuId != null and outSkuId != ''"> and out_sku_id = #{outSkuId}</if>
|
|
<if test="price != null "> and price = #{price}</if>
|
|
<if test="pic != null and pic != ''"> and pic = #{pic}</if>
|
|
<if test="spData != null and spData != ''"> and sp_data = #{spData}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getlist" resultType="com.wzj.soopin.goods.domain.vo.SkuVO">
|
|
SELECT
|
|
s.*,
|
|
p.name AS productName
|
|
FROM
|
|
pms_sku s
|
|
LEFT JOIN
|
|
pms_product p ON s.product_id = p.id
|
|
WHERE 1=1
|
|
<if test="tenantId != '000000'">
|
|
AND s.tenant_id = #{tenantId}
|
|
</if>
|
|
<if test="query.productName != null and query.productName != ''">
|
|
AND p.name LIKE CONCAT('%', #{query.productName}, '%')
|
|
</if>
|
|
<if test="query.outSkuId != null and query.outSkuId != ''">
|
|
AND s.out_sku_id LIKE CONCAT('%', #{query.outSkuId}, '%')
|
|
</if>
|
|
<if test="query.price != null and query.price != ''">
|
|
AND s.price LIKE CONCAT('%', #{query.price}, '%')
|
|
</if>
|
|
<if test="query.pic != null and query.pic != ''">
|
|
AND s.pic LIKE CONCAT('%', #{query.pic}, '%')
|
|
</if>
|
|
ORDER BY
|
|
s.create_time DESC
|
|
</select>
|
|
|
|
|
|
<select id="selectSkuByid" resultType="com.wzj.soopin.goods.domain.vo.SkuVO">
|
|
SELECT
|
|
s.*,
|
|
p.name AS productName
|
|
FROM
|
|
pms_sku s
|
|
LEFT JOIN
|
|
pms_product p ON s.product_id = p.id
|
|
WHERE
|
|
s.id = #{id}
|
|
</select>
|
|
|
|
</mapper>
|