feat(goods): 优化 SKU 查询逻辑,增加删除标记过滤条件在 SkuMapper.xml 的 getList 查询中,新增对 sku 和 product 表的 del_flag = '0' 过滤条件,确保查询结果仅包含未删除的数据。同时调整 SQL 格式以提升可读性。```
This commit is contained in:
huk 2025-09-20 14:09:25 +08:00
parent 4a369920df
commit b5b588eb2c

View File

@ -15,8 +15,7 @@ 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,
@ -32,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
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>
@ -51,10 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<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>