统一吴门医述里图文文章

This commit is contained in:
wuchunlei
2024-03-14 15:38:27 +08:00
parent 36bb3fc194
commit 63fdd2759e
8 changed files with 82 additions and 70 deletions

View File

@@ -4,16 +4,13 @@ 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;

View File

@@ -0,0 +1,57 @@
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.GeneralArticle;
import com.peanut.modules.book.service.GeneralArticleService;
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/generalArticle")
public class GeneralArticleController {
@Autowired
private GeneralArticleService generalArticleService;
/**
* 文章列表分页
*/
@RequestMapping(path = "/articleByPage")
public R articleByPage(@RequestBody Map map) {
LambdaQueryWrapper<GeneralArticle> wrapper = new LambdaQueryWrapper();
if (StringUtils.isNotEmpty(map.get("type").toString())){
wrapper.eq(GeneralArticle::getType,map.get("type"));
}
wrapper.orderByAsc(GeneralArticle::getSort);
Page<GeneralArticle> page = generalArticleService.page(new Page<>(
Long.parseLong(map.get("current").toString()), Long.parseLong(map.get("limit").toString())),wrapper);
return R.ok().put("result", page);
}
@RequestMapping(path = "/getArticleById")
public R getArticleById(String id) {
return R.ok().put("result",generalArticleService.getById(id));
}
@RequestMapping(path = "/saveOrUpdateArticle")
public R saveOrUpdateArticle(@RequestBody GeneralArticle article) {
generalArticleService.saveOrUpdate(article);
return R.ok();
}
@RequestMapping(path = "/delArticle")
public R delArticle(String id) {
generalArticleService.removeById(id);
return R.ok();
}
}

View File

@@ -28,8 +28,6 @@ import java.util.Map;
@RequestMapping("book/medicaldes")
public class MedicaldesController {
@Autowired
private MedicaldesRecordService recordService;
@Autowired
private MedicaldesLightService lightService;
@Autowired
@@ -355,49 +353,4 @@ public class MedicaldesController {
return R.ok();
}
/**
* 吴门纪实列表
*/
@RequestMapping(path = "/recordByType")
public R recordByType(String type) {
LambdaQueryWrapper<MedicaldesRecord> wrapper = new LambdaQueryWrapper();
if (StringUtils.isNotEmpty(type)){
wrapper.eq(MedicaldesRecord::getType,type);
}
wrapper.orderByAsc(MedicaldesRecord::getSort);
List<MedicaldesRecord> list = recordService.list(wrapper);
return R.ok().put("result", list);
}
/**
* 吴门纪实列表
*/
@RequestMapping(path = "/recordByPage")
public R recordByPage(@RequestBody Map map) {
LambdaQueryWrapper<MedicaldesRecord> wrapper = new LambdaQueryWrapper();
if (map.containsKey("type")&&StringUtils.isNotEmpty(map.get("type").toString())){
wrapper.eq(MedicaldesRecord::getType,map.get("type"));
}
wrapper.orderByAsc(MedicaldesRecord::getSort);
Page<MedicaldesRecord> page = recordService.page(new Page<>(
Long.parseLong(map.get("current").toString()), Long.parseLong(map.get("limit").toString())),wrapper);
return R.ok().put("result", page);
}
@RequestMapping(path = "/getRecordById")
public R getRecordById(String id) {
return R.ok().put("result",recordService.getById(id));
}
@RequestMapping(path = "/saveOrUpdateRecord")
public R saveOrUpdateRecord(@RequestBody MedicaldesRecord record) {
recordService.saveOrUpdate(record);
return R.ok();
}
@RequestMapping(path = "/delRecord")
public R delRecord(String id) {
recordService.removeById(id);
return R.ok();
}
}