修改商品列表

This commit is contained in:
fxh 2025-08-15 19:47:41 +08:00
parent e0f6ccace8
commit ccadf33e19
5 changed files with 33 additions and 4 deletions

View File

@ -26,8 +26,8 @@ public class AppProductController {
@Tag(name = "查询商品信息列表")
@PostMapping("page")
public R<IPage<ProductVO>> page(@RequestBody ProductBo query, Page<Product> page) {
Page<Product> productCategoryPage = service.page(page,query.toWrapper());
return R.ok(convert.toVO(productCategoryPage));
IPage<ProductVO> resultPage = service.getProduct(page, query);
return R.ok(resultPage);
}
@Tag(name ="获取商品信息详细信息")

View File

@ -106,7 +106,7 @@ public class ProductVO extends BaseAudit {
@Schema(description = "SKU列表")
private List<Sku> skuList;
@Schema(description = "店铺名称")
@Schema(description = "联系人")
private String contactUserName;
@Schema(description = "店铺手机号")
@ -133,4 +133,8 @@ public class ProductVO extends BaseAudit {
@Schema(description = "优惠金额")
private BigDecimal discountPrice;
@Schema(description = "店铺名称")
private String storeName;
}

View File

@ -50,4 +50,7 @@ public interface ProductMapper extends BaseMapper<Product> {
"SUM(CASE WHEN auth_flag = 2 THEN 1 ELSE 0 END) AS count2 " +
"FROM pms_product")
Map<String, Object> countProduct();
IPage<ProductVO> getProduct(@Param("page") Page<Product> page, @Param("query") ProductBo query);
}

View File

@ -161,4 +161,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
//删除商品主表数据
return productMapper.deleteById(id) > 0;
}
public IPage<ProductVO> getProduct(Page<Product> page, ProductBo query) {
return productMapper.getProduct(page, query);
}
}

View File

@ -130,6 +130,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
p.id = #{id}
</select>
<select id="getProduct" resultType="com.wzj.soopin.goods.domain.vo.ProductVO">
SELECT
p.*,
t.store_name AS storeName
FROM
pms_product p
LEFT JOIN
sys_tenant t ON p.tenant_id = t.tenant_id
<where>
<if test="query.nameLike != null and query.nameLike != ''">
AND p.name LIKE CONCAT('%', #{query.nameLike}, '%')
</if>
<if test="query.categoryId != null">
AND p.category_id = #{query.categoryId}
</if>
</where>
</select>
<resultMap id="ProductWithSkusResultMap" type="ProductVO">
<id property="id" column="id"/>
<result property="name" column="name"/>