new prescript
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.PrescriptCategoryEntity;
|
||||
import com.peanut.modules.book.service.PrescriptCategoryService;
|
||||
import com.peanut.modules.book.service.PrescriptService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("book/prescript")
|
||||
public class PrescriptController {
|
||||
@Autowired
|
||||
private PrescriptService prescriptService;
|
||||
@Autowired
|
||||
private PrescriptCategoryService prescriptCategoryService;
|
||||
|
||||
/**
|
||||
* 获取方剂分类列表
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/getPrescriptCategoryList")
|
||||
public R getPrescriptCategoryList(){
|
||||
List<PrescriptCategoryEntity> prescriptCategoryList = prescriptCategoryService.getPrescriptCategoryList();
|
||||
|
||||
return R.ok().put("list",prescriptCategoryList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加方剂分类
|
||||
* @param p
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/addPrescriptCategory")
|
||||
public R addPrescriptCategory(@RequestBody PrescriptCategoryEntity p){
|
||||
prescriptCategoryService.save(p);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑方剂分类信息
|
||||
* @param p
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/editPrescriptCategory")
|
||||
public R editPrescriptCategory(@RequestBody PrescriptCategoryEntity p){
|
||||
prescriptCategoryService.updateById(p);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除方剂分类
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("/delPrescriptCategory")
|
||||
public R delPrescriptCategory(@RequestBody Map<String,Object> map){
|
||||
Integer id = Integer.valueOf(map.get("prescriptCategoryId").toString());
|
||||
boolean b = prescriptCategoryService.delPrescriptCategory(id);
|
||||
if(b){
|
||||
return R.ok();
|
||||
}else{
|
||||
return R.error();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user