refactor(mall): 优化分类查询接口参数类型和逻辑

- 将 ApiProdController 中 categoryByAncestors 方法的参数类型从 Long 改为 String
- 修改 ITzCategoryService 接口中 listByAncestors 方法的参数类型从 Long 改为 String- 更新 TzCategoryServiceImpl 中 listByAncestors 方法,移除对 subset 字段的查询条件- 优化 listByParentId 方法,移除对 subset 字段的查询条件
This commit is contained in:
清晨
2025-05-12 17:48:26 +08:00
parent d57fc6f4ad
commit 1640ba4b7d
3 changed files with 5 additions and 5 deletions

View File

@@ -225,7 +225,7 @@ public class ApiProdController {
@GetMapping("/categoryByAncestors") @GetMapping("/categoryByAncestors")
@Operation(summary = "根据祖级ID获取分类信息列表", description = "获取所有的产品分类信息顶级分类的ancestors为0,默认为顶级分类") @Operation(summary = "根据祖级ID获取分类信息列表", description = "获取所有的产品分类信息顶级分类的ancestors为0,默认为顶级分类")
@Parameter(name = "ancestors", description = "祖级ID") @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); List<TzCategoryVo> categories = categoryService.listByAncestors(ancestors);
return ServerResponseEntity.success(categories); return ServerResponseEntity.success(categories);
} }

View File

@@ -74,5 +74,5 @@ public interface ITzCategoryService {
* @param ancestors * @param ancestors
* @return * @return
*/ */
List<TzCategoryVo> listByAncestors(Long ancestors); List<TzCategoryVo> listByAncestors(String ancestors);
} }

View File

@@ -124,15 +124,15 @@ public class TzCategoryServiceImpl implements ITzCategoryService {
*/ */
@Override @Override
public List<TzCategoryVo> listByParentId(Long parentId) { 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 @Override
public List<TzCategoryVo> listByAncestors(Long ancestors) { public List<TzCategoryVo> listByAncestors(String ancestors) {
return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().like(TzCategory::getAncestors, ancestors).eq(TzCategory::getStatus,1).eq(TzCategory::getSubset,1)); return baseMapper.selectVoList(new LambdaQueryWrapper<TzCategory>().like(TzCategory::getAncestors, ancestors).eq(TzCategory::getStatus,1));
} }
/** /**