refactor(goods): 优化商品相关代码结构

- 移除 ProductMapper 中不必要的订单相关联接查询
- 优化 ProductServiceImpl 中的 getList 方法
- 注释 ProductVO 中的 distribution 字段
- 在 SkuMapper 中添加 productId 的精确查询条件
This commit is contained in:
huk 2025-09-03 13:09:35 +08:00
parent 886a9cb4de
commit 5e6f6c9c3d
4 changed files with 7 additions and 6 deletions

View File

@ -124,8 +124,8 @@ public class ProductVO extends BaseAudit {
@Schema(description = "商品类型 1.团购;->2.拼团;3->秒杀")
private Integer type;
@Schema(description = "配送方式 1->到店核销2->自提;3->配送;")
private Integer distribution;
// @Schema(description = "配送方式 1->到店核销2->自提;3->配送;")
// private Integer distribution;
@Schema(description = "描述")
private String describe;

View File

@ -45,7 +45,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
public IPage<ProductVO> getList(ProductBo query, Page<Product> page) {
Long tenantId = Long.valueOf(LoginHelper.getTenantId());
return productMapper.getlist(page,query,tenantId);
IPage<ProductVO> getlist = productMapper.getlist(page, query, tenantId);
return getlist;
}

View File

@ -63,7 +63,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
b.logo AS brandLogo,
t.store_name AS contactUserName,
t.contact_phone AS contactPhone,
o.distribution AS distribution,
pc.name AS productCategoryName,
s.id AS sku_id,
s.out_sku_id,
@ -76,8 +75,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
pms_product p
LEFT JOIN pms_brand b ON p.brand_id = b.id
LEFT JOIN sys_tenant t ON p.tenant_id = t.tenant_id
LEFT JOIN oms_order_item oi ON p.id = oi.product_id
LEFT JOIN oms_order o ON oi.order_id = o.id
LEFT JOIN pms_product_category pc ON p.category_id = pc.id
LEFT JOIN pms_sku s ON p.id = s.product_id
WHERE 1=1

View File

@ -60,6 +60,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.productName != null and query.productName != ''">
AND p.name LIKE CONCAT('%', #{query.productName}, '%')
</if>
<if test="query.productId != null and query.productId != ''">
AND p.id = #{query.productId}
</if>
<if test="query.outSkuId != null and query.outSkuId != ''">
AND s.out_sku_id LIKE CONCAT('%', #{query.outSkuId}, '%')
</if>