prescript
This commit is contained in:
@@ -33,11 +33,7 @@ public class PrescriptController {
|
||||
*/
|
||||
@RequestMapping("/getPrescriptList")
|
||||
public R getPrescriptList(@RequestBody Map<String,Object> map){
|
||||
Integer limit = Integer.valueOf(map.get("limit").toString());
|
||||
Integer page = Integer.valueOf(map.get("page").toString());
|
||||
Integer prescriptCategoryId = Integer.valueOf(map.get("prescriptCategoryId").toString());
|
||||
Page<PrescriptEntity> prescriptList = prescriptService.getPrescriptList(prescriptCategoryId, limit, page);
|
||||
return R.ok().put("page",prescriptList);
|
||||
return getR(map);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -104,6 +100,34 @@ public class PrescriptController {
|
||||
return R.ok().put("list",categoryByPid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取方剂文章列表
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/prescriptList")
|
||||
public R prescriptList(@RequestBody Map<String,Object> map){
|
||||
return getR(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取方剂文章列表(经方)
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/prescriptListForJF")
|
||||
public R prescriptListForJF(@RequestBody Map<String,Object> map){
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
private R getR(@RequestBody Map<String, Object> map) {
|
||||
Integer limit = Integer.valueOf(map.get("limit").toString());
|
||||
Integer page = Integer.valueOf(map.get("page").toString());
|
||||
Integer id = Integer.valueOf(map.get("prescriptCategoryId").toString());
|
||||
Page<PrescriptEntity> prescriptList = prescriptService.getPrescriptList(id, limit, page);
|
||||
return R.ok().put("page",prescriptList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取方剂分类列表
|
||||
|
||||
@@ -21,6 +21,9 @@ public class PrescriptCategoryEntity {
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
@TableField(exist = false)
|
||||
private PrescriptCategoryEntity child;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<PrescriptCategoryEntity> children;
|
||||
|
||||
|
||||
@@ -40,4 +40,7 @@ public class PrescriptEntity {
|
||||
@TableField(exist = false)
|
||||
private List<String> imageList;
|
||||
|
||||
@TableField(exist = false)
|
||||
private PrescriptCategoryEntity prescriptCategoryEntity;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -31,7 +30,19 @@ public class PrescriptServiceImpl extends ServiceImpl<PrescriptDao, PrescriptEn
|
||||
Page<PrescriptEntity> prescriptEntityPage = getBaseMapper().selectPage(new Page<>(page, limit), wrapper);
|
||||
for (PrescriptEntity p : prescriptEntityPage.getRecords()){
|
||||
p.setImageList(JSON.parseArray(p.getImages(),String.class));
|
||||
p.setPrescriptCategoryEntity(getTree(p.getPrescriptCategoryId()));
|
||||
}
|
||||
return prescriptEntityPage;
|
||||
}
|
||||
|
||||
|
||||
private PrescriptCategoryEntity getTree(int categoryId){
|
||||
PrescriptCategoryEntity prescriptCategoryEntity = prescriptCategoryDao.selectOne(new LambdaQueryWrapper<PrescriptCategoryEntity>().eq(PrescriptCategoryEntity::getPrescriptCategoryId,categoryId));
|
||||
if(prescriptCategoryEntity.getPid()==0){
|
||||
return prescriptCategoryEntity;
|
||||
}
|
||||
PrescriptCategoryEntity tree = getTree(prescriptCategoryEntity.getPid());
|
||||
tree.setChild(prescriptCategoryEntity);
|
||||
return tree;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user