血脉初建
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user