血脉初建

This commit is contained in:
wangjinlei
2023-11-02 13:24:19 +08:00
parent 82f8201468
commit 2996a1bbc7
7 changed files with 107 additions and 11 deletions

View File

@@ -3,5 +3,9 @@ package com.peanut.modules.book.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.peanut.modules.book.entity.PointCategoryEntity;
import java.util.List;
public interface PointCategoryService extends IService<PointCategoryEntity> {
List<PointCategoryEntity> getCategoryList();
}

View File

@@ -1,11 +1,33 @@
package com.peanut.modules.book.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.peanut.modules.book.dao.PointCategoryDao;
import com.peanut.modules.book.entity.PointCategoryEntity;
import com.peanut.modules.book.service.PointCategoryService;
import org.springframework.stereotype.Service;
import java.util.List;
@Service("pointCategoryService")
public class PointCategoryServiceImpl extends ServiceImpl<PointCategoryDao, PointCategoryEntity> implements PointCategoryService {
@Override
public List<PointCategoryEntity> getCategoryList() {
LambdaQueryWrapper<PointCategoryEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PointCategoryEntity::getPid,0);
wrapper.orderByDesc(PointCategoryEntity::getSort);
List<PointCategoryEntity> list = list(wrapper);
for (PointCategoryEntity p : list){
LambdaQueryWrapper<PointCategoryEntity> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(PointCategoryEntity::getPid,p.getId());
wrapper1.orderByDesc(PointCategoryEntity::getSort);
List<PointCategoryEntity> list1 = list(wrapper1);
p.setChildren(list1);
}
return list;
}
}