|
|
@ -61,10 +61,15 @@ public class CmsCategoryServiceImpl extends ServiceImpl<CmsCategoryMapper, CmsCa |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public BaseResponse<List<?>> queryCategory() { |
|
|
|
public BaseResponse<List<?>> queryCategory() { |
|
|
|
List<CmsCategory> categoryPid = query().eq("category_pid", 0).list(); |
|
|
|
//先查父栏目并排序
|
|
|
|
|
|
|
|
List<CmsCategory> categoryPid = query() |
|
|
|
|
|
|
|
.eq("category_pid", 0) |
|
|
|
|
|
|
|
.orderByAsc("sort").list(); |
|
|
|
for (int i = 0; i < categoryPid.size(); i++) { |
|
|
|
for (int i = 0; i < categoryPid.size(); i++) { |
|
|
|
//查孩子
|
|
|
|
//查孩子并排序
|
|
|
|
categoryPid.get(i).setChildrenNode(query().eq("category_pid", categoryPid.get(i).getId()).list()); |
|
|
|
categoryPid.get(i).setChildrenNode(query() |
|
|
|
|
|
|
|
.eq("category_pid", categoryPid.get(i).getId()) |
|
|
|
|
|
|
|
.orderByAsc("sort").list()); |
|
|
|
} |
|
|
|
} |
|
|
|
return ResultUtils.success(categoryPid); |
|
|
|
return ResultUtils.success(categoryPid); |
|
|
|
} |
|
|
|
} |
|
|
|