feat(mall): 修改商品分类查询逻辑

- 将 TzProd、TzProdBo 和 TzProdVo 中的 categoryId 类型从 Long 改为 String
- 修改 TzProdServiceImpl 中的 pageByCategoryId 方法,使用 like 查询替代 in 查询
- 更新 TzProdServiceImpl 中的条件查询逻辑,使用 like 查询替代 eq 查询
- 移除 WxXcxUtils 中的冗余注释代码
This commit is contained in:
清晨
2025-04-18 09:28:10 +08:00
parent 06fba793ba
commit 444d1af15a
5 changed files with 15 additions and 8 deletions

View File

@@ -29,9 +29,6 @@ public class WxXcxUtils {
String result = HttpRequest.post(url).body(json.toString()).execute().body();
JSONObject jsonObject = JSONObject.parseObject(result);
/*JSONObject phoneInfo = jsonObject.getJSONObject("phone_info");
System.out.println(phoneInfo+"==================================");
String phoneNumber = phoneInfo.get("phoneNumber").toString();*/
return jsonObject;
}

View File

@@ -124,7 +124,7 @@ public class TzProd extends TenantEntity {
/**
* 商品分类
*/
private Long categoryId;
private String categoryId;
/**
* 商品参数json

View File

@@ -130,7 +130,7 @@ public class TzProdBo extends TenantEntity {
/**
* 商品分类
*/
private Long categoryId;
private String categoryId;
/**
* 商品参数json

View File

@@ -145,7 +145,7 @@ public class TzProdVo implements Serializable {
* 商品分类
*/
@ExcelProperty(value = "商品分类")
private Long categoryId;
private String categoryId;
/**
* 商品参数json

View File

@@ -105,7 +105,17 @@ public class TzProdServiceImpl extends MPJBaseServiceImpl<TzProdMapper,TzProd> i
*/
@Override
public IPage<TzProdVo> pageByCategoryId(PageQuery pageQuery, List<Long> categoryId) {
LambdaQueryWrapper<TzProd> lqw = new LambdaQueryWrapper<TzProd>().eq(TzProd::getStatus,1).in(categoryId != null,TzProd::getCategoryId,categoryId);
// 构造查询条件
LambdaQueryWrapper<TzProd> lqw = new LambdaQueryWrapper<TzProd>()
.eq(TzProd::getStatus, 1)
.and(wrapper -> {
for (Long id : categoryId) {
wrapper.or(w -> w.like(TzProd::getCategoryId, String.valueOf(id)));
}
})
.orderByDesc(TzProd::getPutawayTime);
// 执行分页查询
return baseMapper.selectVoPage(pageQuery.build(), lqw);
}
@@ -171,7 +181,7 @@ public class TzProdServiceImpl extends MPJBaseServiceImpl<TzProdMapper,TzProd> i
lqw.like(StringUtils.isNotBlank(bo.getFactoryAddress()), TzProd::getFactoryAddress, bo.getFactoryAddress());
lqw.eq(bo.getStatus() != null, TzProd::getStatus, bo.getStatus());
lqw.eq(bo.getExamineFlag() != null, TzProd::getExamineFlag, bo.getExamineFlag());
lqw.eq(bo.getCategoryId() != null, TzProd::getCategoryId, bo.getCategoryId());
lqw.like(bo.getCategoryId() != null, TzProd::getCategoryId, bo.getCategoryId());
lqw.between(params.get("beginTime") != null && params.get("endTime") != null,
TzProd::getPutawayTime, params.get("beginTime"), params.get("endTime"));
return lqw;