prescript
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.book.entity.PrescriptCategoryEntity;
|
||||
import com.peanut.modules.book.entity.PrescriptEntity;
|
||||
@@ -8,4 +9,5 @@ import java.util.List;
|
||||
|
||||
public interface PrescriptService extends IService<PrescriptEntity> {
|
||||
|
||||
Page<PrescriptEntity> getPrescriptList(int prescriptCategoryId,int limit,int page);
|
||||
}
|
||||
|
||||
@@ -22,9 +22,10 @@ public class PrescriptCategoryServiceImpl extends ServiceImpl<PrescriptCategoryD
|
||||
public List<PrescriptCategoryEntity> getPrescriptCategoryList() {
|
||||
LambdaQueryWrapper<PrescriptCategoryEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PrescriptCategoryEntity::getPid,0);
|
||||
wrapper.orderByDesc(PrescriptCategoryEntity::getSort);
|
||||
List<PrescriptCategoryEntity> list = list(wrapper);
|
||||
for (PrescriptCategoryEntity p:list){
|
||||
p.setChildren(list(new LambdaQueryWrapper<PrescriptCategoryEntity>().eq(PrescriptCategoryEntity::getPid,p.getPrescriptCategoryId())));
|
||||
p.setChildren(list(new LambdaQueryWrapper<PrescriptCategoryEntity>().eq(PrescriptCategoryEntity::getPid,p.getPrescriptCategoryId()).orderByDesc(PrescriptCategoryEntity::getSort)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.book.dao.PrescriptCategoryDao;
|
||||
import com.peanut.modules.book.dao.PrescriptDao;
|
||||
@@ -18,4 +20,13 @@ public class PrescriptServiceImpl extends ServiceImpl<PrescriptDao, PrescriptEn
|
||||
@Autowired
|
||||
private PrescriptCategoryDao prescriptCategoryDao;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<PrescriptEntity> getPrescriptList(int prescriptCategoryId, int limit, int page) {
|
||||
LambdaQueryWrapper<PrescriptEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(prescriptCategoryId>0,PrescriptEntity::getPrescriptCategoryId,prescriptCategoryId);
|
||||
wrapper.orderByDesc(PrescriptEntity::getSort);
|
||||
Page<PrescriptEntity> prescriptEntityPage = getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
return prescriptEntityPage;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user