refactor(mall): 优化分类查询接口参数类型和逻辑
- 将 ApiProdController 中 categoryByAncestors 方法的参数类型从 Long 改为 String - 修改 ITzCategoryService 接口中 listByAncestors 方法的参数类型从 Long 改为 String- 更新 TzCategoryServiceImpl 中 listByAncestors 方法,移除对 subset 字段的查询条件- 优化 listByParentId 方法,移除对 subset 字段的查询条件
This commit is contained in:
@@ -225,7 +225,7 @@ public class ApiProdController {
|
||||
@GetMapping("/categoryByAncestors")
|
||||
@Operation(summary = "根据祖级ID获取分类信息列表", description = "获取所有的产品分类信息,顶级分类的ancestors为0,默认为顶级分类")
|
||||
@Parameter(name = "ancestors", description = "祖级ID")
|
||||
public ServerResponseEntity<List<TzCategoryVo>> categoryByAncestors(@RequestParam(value = "ancestors", defaultValue = "0") Long ancestors) {
|
||||
public ServerResponseEntity<List<TzCategoryVo>> categoryByAncestors(@RequestParam(value = "ancestors", defaultValue = "0") String ancestors) {
|
||||
List<TzCategoryVo> categories = categoryService.listByAncestors(ancestors);
|
||||
return ServerResponseEntity.success(categories);
|
||||
}
|
||||
|
||||
@@ -74,5 +74,5 @@ public interface ITzCategoryService {
|
||||
* @param ancestors
|
||||
* @return
|
||||
*/
|
||||
List<TzCategoryVo> listByAncestors(Long ancestors);
|
||||
List<TzCategoryVo> listByAncestors(String ancestors);
|
||||
}
|
||||
|
||||
@@ -124,15 +124,15 @@ public class TzCategoryServiceImpl implements ITzCategoryService {
|
||||
*/
|
||||
@Override
|
||||
public List<TzCategoryVo> listByParentId(Long parentId) {
|
||||
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().eq(TzCategory::getParentId, parentId).eq(TzCategory::getStatus,1).eq(TzCategory::getSubset,1));
|
||||
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().eq(TzCategory::getParentId, parentId).eq(TzCategory::getStatus,1));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类信息列表
|
||||
*/
|
||||
@Override
|
||||
public List<TzCategoryVo> listByAncestors(Long ancestors) {
|
||||
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().like(TzCategory::getAncestors, ancestors).eq(TzCategory::getStatus,1).eq(TzCategory::getSubset,1));
|
||||
public List<TzCategoryVo> listByAncestors(String ancestors) {
|
||||
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().like(TzCategory::getAncestors, ancestors).eq(TzCategory::getStatus,1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user