prescript
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.PrescriptCategoryEntity;
|
||||
@@ -48,6 +49,18 @@ public class PrescriptController {
|
||||
return R.ok().put("prescript",prescript);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取方剂文章详情
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/prescriptDetail")
|
||||
public R prescriptDetail(@RequestBody Map<String,Object> map){
|
||||
Integer integer = Integer.valueOf(map.get("prescriptId").toString());
|
||||
PrescriptEntity prescript = prescriptService.getById(integer);
|
||||
return R.ok().put("prescript",prescript);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加方剂文章
|
||||
* @param p
|
||||
@@ -71,7 +84,7 @@ public class PrescriptController {
|
||||
public R editPrescript(@RequestBody PrescriptEntity p){
|
||||
if(p.getImageList()!=null&&p.getImageList().size()>0){
|
||||
p.setImages(JSON.toJSONString(p.getImageList()));
|
||||
} else if (!p.getImages().equals("")&&(p.getImageList()==null||p.getImageList().size()==0)) {
|
||||
} else if (StringUtils.isNotBlank(p.getImages()) &&(p.getImageList()==null||p.getImageList().size()==0)) {
|
||||
p.setImages("");
|
||||
}
|
||||
prescriptService.updateById(p);
|
||||
@@ -114,15 +127,13 @@ public class PrescriptController {
|
||||
|
||||
/**
|
||||
* 获取方剂文章列表(经方)
|
||||
* @param map
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/prescriptListForJF")
|
||||
public R prescriptListForJF(@RequestBody Map<String,Object> map){
|
||||
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);
|
||||
public R prescriptListForJF(){
|
||||
List<PrescriptEntity> prescriptListForJF = prescriptService.getPrescriptListForJF();
|
||||
return R.ok().put("list",prescriptListForJF);
|
||||
}
|
||||
|
||||
private R getR(@RequestBody Map<String, Object> map) {
|
||||
|
||||
@@ -11,5 +11,5 @@ public interface PrescriptService extends IService<PrescriptEntity> {
|
||||
|
||||
Page<PrescriptEntity> getPrescriptList(int prescriptCategoryId,int limit,int page);
|
||||
|
||||
Page<PrescriptEntity> getPrescriptListForJF(int limit,int page);
|
||||
List<PrescriptEntity> getPrescriptListForJF();
|
||||
}
|
||||
|
||||
@@ -42,13 +42,14 @@ public class PrescriptServiceImpl extends ServiceImpl<PrescriptDao, PrescriptEn
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PrescriptEntity> getPrescriptListForJF(int limit, int page) {
|
||||
public List<PrescriptEntity> getPrescriptListForJF() {
|
||||
QueryWrapper<PrescriptEntity> wrapper = new QueryWrapper<>();
|
||||
wrapper.select("prescript.*","to_first_pinyin(title) letter");
|
||||
wrapper.select("prescript_id","title","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;
|
||||
List<PrescriptEntity> list = list(wrapper);
|
||||
// Page<PrescriptEntity> page1 = page(new Page<PrescriptEntity>(page, limit), wrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
private PrescriptCategoryEntity getTree(int categoryId){
|
||||
|
||||
Reference in New Issue
Block a user