```
feat(goods): 优化 SKU 查询逻辑,增加删除标记过滤条件在 SkuMapper.xml 的 getList 查询中,新增对 sku 和 product 表的 del_flag = '0' 过滤条件,确保查询结果仅包含未删除的数据。同时调整 SQL 格式以提升可读性。```
This commit is contained in:
parent
4a369920df
commit
b5b588eb2c
@ -15,46 +15,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<select id="getlist" resultType="com.wzj.soopin.goods.domain.vo.SkuVO">
|
<select id="getlist" resultType="com.wzj.soopin.goods.domain.vo.SkuVO">
|
||||||
SELECT
|
SELECT s.id,
|
||||||
s.id,
|
s.product_id,
|
||||||
s.product_id,
|
s.out_sku_id,
|
||||||
s.out_sku_id,
|
s.price,
|
||||||
s.price,
|
s.pic,
|
||||||
s.pic,
|
s.sp_data,
|
||||||
s.sp_data,
|
s.stock,
|
||||||
s.stock,
|
s.create_by,
|
||||||
s.create_by,
|
s.create_time,
|
||||||
s.create_time,
|
s.update_by,
|
||||||
s.update_by,
|
s.update_time,
|
||||||
s.update_time,
|
p.name AS productName
|
||||||
p.name AS productName
|
|
||||||
FROM
|
FROM
|
||||||
pms_sku s
|
pms_sku s
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
pms_product p ON s.product_id = p.id
|
pms_product p ON s.product_id = p.id
|
||||||
<where>
|
and s.del_flag = '0' and p.del_flag = '0'
|
||||||
<if test="query.productName != null and query.productName != ''">
|
<if test="query.productName != null and query.productName != ''">
|
||||||
AND p.name LIKE CONCAT('%', #{query.productName}, '%')
|
AND p.name LIKE CONCAT('%', #{query.productName}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="query.productId != null">
|
<if test="query.productId != null">
|
||||||
AND p.id = #{query.productId}
|
AND p.id = #{query.productId}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.outSkuId != null and query.outSkuId != ''">
|
<if test="query.outSkuId != null and query.outSkuId != ''">
|
||||||
AND s.out_sku_id LIKE CONCAT('%', #{query.outSkuId}, '%')
|
AND s.out_sku_id LIKE CONCAT('%', #{query.outSkuId}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="query.price != null">
|
<if test="query.price != null">
|
||||||
AND s.price = #{query.price}
|
AND s.price = #{query.price}
|
||||||
</if>
|
</if>
|
||||||
<if test="query.pic != null and query.pic != ''">
|
<if test="query.pic != null and query.pic != ''">
|
||||||
AND s.pic LIKE CONCAT('%', #{query.pic}, '%')
|
AND s.pic LIKE CONCAT('%', #{query.pic}, '%')
|
||||||
</if>
|
</if>
|
||||||
<if test="query.tenantId != null and query.tenantId != ''">
|
<if test="query.tenantId != null and query.tenantId != ''">
|
||||||
AND s.tenant_id = #{query.tenantId}
|
AND s.tenant_id = #{query.tenantId}
|
||||||
</if>
|
</if>
|
||||||
|
ORDER BY s.create_time DESC
|
||||||
</where>
|
|
||||||
ORDER BY
|
|
||||||
s.create_time DESC
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
@ -68,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
pms_product p ON s.product_id = p.id
|
pms_product p ON s.product_id = p.id
|
||||||
WHERE
|
WHERE
|
||||||
s.id = #{id}
|
s.id = #{id}
|
||||||
|
and s.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user