统一吴门医述里图文文章
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.book.entity.MedicaldesRecord;
|
||||
import com.peanut.modules.book.entity.GeneralArticle;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MedicaldesRecordDao extends MPJBaseMapper<MedicaldesRecord> {
|
||||
public interface GeneralArticleDao extends MPJBaseMapper<GeneralArticle> {
|
||||
}
|
||||
@@ -8,8 +8,8 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("medicaldes_record")
|
||||
public class MedicaldesRecord implements Serializable {
|
||||
@TableName("general_article")
|
||||
public class GeneralArticle implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ public class MedicaldesRecord implements Serializable {
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 照片
|
||||
* 外链
|
||||
*/
|
||||
private String image;
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 内容
|
||||
@@ -32,7 +32,12 @@ public class MedicaldesRecord implements Serializable {
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 类型1学术贡献、2抗疫纪实、3吴门公益
|
||||
* 文章类型 1文章 2外链形式
|
||||
*/
|
||||
private Integer contentType;
|
||||
|
||||
/**
|
||||
* 类型 1学术思想 2学术平台
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.book.entity.MedicaldesRecord;
|
||||
import com.peanut.modules.book.entity.GeneralArticle;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface MedicaldesRecordService extends IService<MedicaldesRecord> {
|
||||
public interface GeneralArticleService extends IService<GeneralArticle> {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.book.dao.GeneralArticleDao;
|
||||
import com.peanut.modules.book.entity.GeneralArticle;
|
||||
import com.peanut.modules.book.service.GeneralArticleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class GeneralArticleServiceImpl extends ServiceImpl<GeneralArticleDao, GeneralArticle> implements GeneralArticleService {
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.peanut.modules.book.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.peanut.modules.book.dao.MedicaldesRecordDao;
|
||||
import com.peanut.modules.book.entity.MedicaldesRecord;
|
||||
import com.peanut.modules.book.service.MedicaldesRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MedicaldesRecordServiceImpl extends ServiceImpl<MedicaldesRecordDao, MedicaldesRecord> implements MedicaldesRecordService {
|
||||
}
|
||||
Reference in New Issue
Block a user