prescript
This commit is contained in:
@@ -119,8 +119,10 @@ public class PrescriptController {
|
||||
*/
|
||||
@RequestMapping("/prescriptListForJF")
|
||||
public R prescriptListForJF(@RequestBody Map<String,Object> map){
|
||||
|
||||
return R.ok();
|
||||
Integer limit = Integer.valueOf(map.get("limit").toString());
|
||||
Integer page = Integer.valueOf(map.get("page").toString());
|
||||
Page<PrescriptEntity> prescriptListForJF = prescriptService.getPrescriptListForJF(limit, page);
|
||||
return R.ok().put("page",prescriptListForJF);
|
||||
}
|
||||
|
||||
private R getR(@RequestBody Map<String, Object> map) {
|
||||
|
||||
@@ -37,6 +37,9 @@ public class PrescriptEntity {
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String letter;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<String> imageList;
|
||||
|
||||
|
||||
@@ -10,4 +10,6 @@ import java.util.List;
|
||||
public interface PrescriptService extends IService<PrescriptEntity> {
|
||||
|
||||
Page<PrescriptEntity> getPrescriptList(int prescriptCategoryId,int limit,int page);
|
||||
|
||||
Page<PrescriptEntity> getPrescriptListForJF(int limit,int page);
|
||||
}
|
||||
|
||||
@@ -22,10 +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);
|
||||
wrapper.orderByAsc(PrescriptCategoryEntity::getSort);
|
||||
List<PrescriptCategoryEntity> list = list(wrapper);
|
||||
for (PrescriptCategoryEntity p:list){
|
||||
p.setChildren(list(new LambdaQueryWrapper<PrescriptCategoryEntity>().eq(PrescriptCategoryEntity::getPid,p.getPrescriptCategoryId()).orderByDesc(PrescriptCategoryEntity::getSort)));
|
||||
p.setChildren(list(new LambdaQueryWrapper<PrescriptCategoryEntity>().eq(PrescriptCategoryEntity::getPid,p.getPrescriptCategoryId()).orderByAsc(PrescriptCategoryEntity::getSort)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public class PrescriptCategoryServiceImpl extends ServiceImpl<PrescriptCategoryD
|
||||
public List<PrescriptCategoryEntity> getCategoryByPid(Integer pid) {
|
||||
LambdaQueryWrapper<PrescriptCategoryEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PrescriptCategoryEntity::getPid,pid);
|
||||
wrapper.orderByDesc(PrescriptCategoryEntity::getSort);
|
||||
wrapper.orderByAsc(PrescriptCategoryEntity::getSort);
|
||||
List<PrescriptCategoryEntity> list = list(wrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.book.dao.PrescriptCategoryDao;
|
||||
@@ -19,10 +20,10 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Service("prescriptService")
|
||||
public class PrescriptServiceImpl extends ServiceImpl<PrescriptDao, PrescriptEntity> implements PrescriptService {
|
||||
|
||||
@Autowired
|
||||
private PrescriptCategoryDao prescriptCategoryDao;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<PrescriptEntity> getPrescriptList(int prescriptCategoryId, int limit, int page) {
|
||||
LambdaQueryWrapper<PrescriptEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
@@ -31,7 +32,7 @@ public class PrescriptServiceImpl extends ServiceImpl<PrescriptDao, PrescriptEn
|
||||
getCategoryIds(prescriptCategoryId,list);
|
||||
wrapper.in(PrescriptEntity::getPrescriptCategoryId,list);
|
||||
}
|
||||
wrapper.orderByDesc(PrescriptEntity::getSort);
|
||||
wrapper.orderByAsc(PrescriptEntity::getSort);
|
||||
Page<PrescriptEntity> prescriptEntityPage = getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
for (PrescriptEntity p : prescriptEntityPage.getRecords()){
|
||||
p.setImageList(JSON.parseArray(p.getImages(),String.class));
|
||||
@@ -40,6 +41,15 @@ public class PrescriptServiceImpl extends ServiceImpl<PrescriptDao, PrescriptEn
|
||||
return prescriptEntityPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PrescriptEntity> getPrescriptListForJF(int limit, int page) {
|
||||
QueryWrapper<PrescriptEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.select("prescript.*","to_first_pinyin(title) letter");
|
||||
wrapper.eq("prescript_category_id",3);
|
||||
wrapper.orderByAsc("CONVERT(title USING gbk) COLLATE gbk_chinese_ci");
|
||||
Page<PrescriptEntity> page1 = page(new Page<PrescriptEntity>(page, limit), wrapper);
|
||||
return page1;
|
||||
}
|
||||
|
||||
private PrescriptCategoryEntity getTree(int categoryId){
|
||||
PrescriptCategoryEntity prescriptCategoryEntity = prescriptCategoryDao.selectOne(new LambdaQueryWrapper<PrescriptCategoryEntity>().eq(PrescriptCategoryEntity::getPrescriptCategoryId,categoryId));
|
||||
@@ -53,7 +63,6 @@ public class PrescriptServiceImpl extends ServiceImpl<PrescriptDao, PrescriptEn
|
||||
|
||||
private void getCategoryIds(int id,List<Integer> list){
|
||||
PrescriptCategoryEntity prescriptCategoryEntity = prescriptCategoryDao.selectOne(new LambdaQueryWrapper<PrescriptCategoryEntity>().eq(PrescriptCategoryEntity::getPrescriptCategoryId, id));
|
||||
|
||||
List<PrescriptCategoryEntity> prescriptCategoryEntities = prescriptCategoryDao.selectList(new LambdaQueryWrapper<PrescriptCategoryEntity>().eq(PrescriptCategoryEntity::getPid, prescriptCategoryEntity.getPrescriptCategoryId()));
|
||||
for (PrescriptCategoryEntity p : prescriptCategoryEntities){
|
||||
getCategoryIds(p.getPrescriptCategoryId(),list);
|
||||
|
||||
Reference in New Issue
Block a user