中医研究
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.ChineseMedicineResearch;
|
||||
import com.peanut.modules.book.entity.MedicaldesRecord;
|
||||
import com.peanut.modules.book.service.ChineseMedicineResearchService;
|
||||
import com.peanut.modules.book.service.MedicaldesRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
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/chineseMedicineResearch")
|
||||
public class ChineseMedicineResearchController {
|
||||
|
||||
@Autowired
|
||||
private ChineseMedicineResearchService chineseMedicineResearchService;
|
||||
|
||||
/**
|
||||
* 中医研究列表
|
||||
*/
|
||||
@RequestMapping(path = "/researchByType")
|
||||
public R researchByType(String type) {
|
||||
LambdaQueryWrapper<ChineseMedicineResearch> wrapper = new LambdaQueryWrapper();
|
||||
if (StringUtils.isNotEmpty(type)){
|
||||
wrapper.eq(ChineseMedicineResearch::getType,type);
|
||||
}
|
||||
wrapper.orderByAsc(ChineseMedicineResearch::getSort);
|
||||
List<ChineseMedicineResearch> list = chineseMedicineResearchService.list(wrapper);
|
||||
return R.ok().put("result", list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 中医研究列表
|
||||
*/
|
||||
@RequestMapping(path = "/researchByPage")
|
||||
public R researchByPage(@RequestBody Map map) {
|
||||
LambdaQueryWrapper<ChineseMedicineResearch> wrapper = new LambdaQueryWrapper();
|
||||
if (map.containsKey("type")&&StringUtils.isNotEmpty(map.get("type").toString())){
|
||||
wrapper.eq(ChineseMedicineResearch::getType,map.get("type"));
|
||||
}
|
||||
wrapper.orderByAsc(ChineseMedicineResearch::getSort);
|
||||
Page<ChineseMedicineResearch> page = chineseMedicineResearchService.page(new Page<>(
|
||||
Long.parseLong(map.get("current").toString()), Long.parseLong(map.get("limit").toString())),wrapper);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getResearchById")
|
||||
public R getResearchById(String id) {
|
||||
return R.ok().put("result",chineseMedicineResearchService.getById(id));
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateResearch")
|
||||
public R saveOrUpdateResearch(@RequestBody ChineseMedicineResearch research) {
|
||||
chineseMedicineResearchService.saveOrUpdate(research);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delResearch")
|
||||
public R delResearch(String id) {
|
||||
chineseMedicineResearchService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user