吴门医述
This commit is contained in:
@@ -0,0 +1,234 @@
|
||||
package com.peanut.modules.book.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.peanut.common.utils.R;
|
||||
import com.peanut.modules.book.entity.*;
|
||||
import com.peanut.modules.book.entity.SysDictDataEntity;
|
||||
import com.peanut.modules.book.service.*;
|
||||
import com.peanut.modules.sys.service.SysDictDataService;
|
||||
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.awt.print.Book;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("book/medicaldes")
|
||||
public class MedicaldesController {
|
||||
|
||||
@Autowired
|
||||
private MedicaldesLightService lightService;
|
||||
@Autowired
|
||||
private MedicaldesBookService medicaldesBookService;
|
||||
@Autowired
|
||||
private MedicaldesInheritService inheritService;
|
||||
@Autowired
|
||||
private MedicaldesInheritRelationService relationService;
|
||||
@Autowired
|
||||
private SysDictDataService sysDictDataService;
|
||||
@Autowired
|
||||
private BookService bookService;
|
||||
|
||||
|
||||
/**
|
||||
* 类型列表
|
||||
*/
|
||||
@RequestMapping(path = "/typeList")
|
||||
public R typeList(String label) {
|
||||
LambdaQueryWrapper<SysDictDataEntity> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(SysDictDataEntity::getDictLabel,label);
|
||||
return R.ok().put("result",sysDictDataService.list(wrapper));
|
||||
}
|
||||
|
||||
/**
|
||||
* 专著出版关系列表
|
||||
*/
|
||||
@RequestMapping(path = "/bookRelationListByType")
|
||||
public R bookRelationListByType(@RequestBody Map map) {
|
||||
MPJLambdaWrapper<MedicaldesBook> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.selectAll(MedicaldesBook.class);
|
||||
wrapper.leftJoin(BookEntity.class,BookEntity::getId,MedicaldesBook::getBookId);
|
||||
if (map.containsKey("dictType")&&StringUtils.isNotEmpty(map.get("dictType").toString())){
|
||||
wrapper.eq(MedicaldesBook::getTypeId,map.get("dictType"));
|
||||
}
|
||||
if (map.containsKey("bookName")&&StringUtils.isNotEmpty(map.get("bookName").toString())){
|
||||
wrapper.like(BookEntity::getName,map.get("bookName"));
|
||||
}
|
||||
Page<MedicaldesBook> res = medicaldesBookService.page(new Page<MedicaldesBook>(
|
||||
Long.parseLong(map.get("current").toString()), Long.parseLong(map.get("limit").toString())), wrapper);
|
||||
List<MedicaldesBook> list = res.getRecords();
|
||||
if (list.size() > 0) {
|
||||
for (MedicaldesBook b : list) {
|
||||
b.setBook(bookService.getById(b.getBookId()));
|
||||
}
|
||||
res.setRecords(list);
|
||||
}
|
||||
return R.ok().put("result", res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 专著出版列表
|
||||
*/
|
||||
@RequestMapping(path = "/bookListByType")
|
||||
public R bookListByType(String type) {
|
||||
MPJLambdaWrapper<BookEntity> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.selectAll(BookEntity.class);
|
||||
wrapper.leftJoin(MedicaldesBook.class,MedicaldesBook::getBookId,BookEntity::getId);
|
||||
wrapper.eq(MedicaldesBook::getTypeId,type);
|
||||
List<BookEntity> list = bookService.list(wrapper);
|
||||
return R.ok().put("result", list);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateBookRelation")
|
||||
public R saveOrUpdateBookRelation(@RequestBody MedicaldesBook medicaldesBook) {
|
||||
medicaldesBookService.saveOrUpdate(medicaldesBook);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delBookRelation")
|
||||
public R delBookRelation(String id) {
|
||||
medicaldesBookService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 学术传承列表分页
|
||||
*/
|
||||
@RequestMapping(path = "/inheritListByPage")
|
||||
public R inheritListByPage(@RequestBody Map map) {
|
||||
MPJLambdaWrapper<MedicaldesInherit> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId);
|
||||
wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId);
|
||||
wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId);
|
||||
wrapper.selectAll(MedicaldesInherit.class);
|
||||
if (map.containsKey("dictType")&&StringUtils.isNotEmpty(map.get("dictType").toString())){
|
||||
wrapper.eq(MedicaldesInheritRelation::getTypeId,map.get("dictType"));
|
||||
}
|
||||
if (map.containsKey("name")&&StringUtils.isNotEmpty(map.get("name").toString())){
|
||||
wrapper.like(MedicaldesInherit::getName,map.get("name"));
|
||||
}
|
||||
Page<MedicaldesInherit> page = inheritService.page(new Page<>(
|
||||
Long.parseLong(map.get("current").toString()), Long.parseLong(map.get("limit").toString())),wrapper);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 学术传承列表按类型、地区
|
||||
*/
|
||||
@RequestMapping(path = "/inheritListByTypeProvId")
|
||||
public R inheritListByTypeProvId(String type,String provId) {
|
||||
MPJLambdaWrapper<MedicaldesInherit> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId);
|
||||
wrapper.eq(MedicaldesInheritRelation::getTypeId,type);
|
||||
wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId);
|
||||
wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId);
|
||||
wrapper.selectAll(MedicaldesInherit.class);
|
||||
wrapper.eq(Province::getProvId,provId);
|
||||
List<MedicaldesInherit> list = inheritService.list(wrapper);
|
||||
return R.ok().put("result", list);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getInheritById")
|
||||
public R getInheritById(String id) {
|
||||
return R.ok().put("result",inheritService.getById(id));
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateInherit")
|
||||
public R addInherit(@RequestBody MedicaldesInherit inherit) {
|
||||
MedicaldesInheritRelation relation = null;
|
||||
if (inherit.getId()==null) {
|
||||
relation = new MedicaldesInheritRelation();
|
||||
}else {
|
||||
LambdaQueryWrapper<MedicaldesInheritRelation> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(MedicaldesInheritRelation::getInheritId,inherit.getId());
|
||||
relation = relationService.getOne(wrapper);
|
||||
}
|
||||
inheritService.saveOrUpdate(inherit);
|
||||
relation.setTypeId(inherit.getType());
|
||||
relation.setInheritId(inherit.getId());
|
||||
relationService.saveOrUpdate(relation);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delInherit")
|
||||
public R delInherit(String id) {
|
||||
inheritService.removeById(id);
|
||||
LambdaQueryWrapper<MedicaldesInheritRelation> wrapper = new LambdaQueryWrapper();
|
||||
wrapper.eq(MedicaldesInheritRelation::getInheritId,id);
|
||||
relationService.removeById(relationService.getOne(wrapper));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getList")
|
||||
public List<Map<String,Object>> getList(String type) {
|
||||
MPJLambdaWrapper<MedicaldesInherit> wrapper = new MPJLambdaWrapper();
|
||||
wrapper.leftJoin(MedicaldesInheritRelation.class,MedicaldesInheritRelation::getInheritId,MedicaldesInherit::getId);
|
||||
wrapper.eq(MedicaldesInheritRelation::getTypeId,type);
|
||||
wrapper.leftJoin(City.class,City::getCityId,MedicaldesInherit::getCityId);
|
||||
wrapper.leftJoin(Province.class,Province::getProvId,City::getProvId);
|
||||
wrapper.selectAs(Province::getProvName,"provinceName");
|
||||
wrapper.selectAs(Province::getProvId,"provinceId");
|
||||
wrapper.select("count(*) as count");
|
||||
wrapper.groupBy("provinceName");
|
||||
List<Map<String,Object>> list = inheritService.listMaps(wrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 吴门之光列表
|
||||
*/
|
||||
@RequestMapping(path = "/lightListByType")
|
||||
public R lightListByType(String type) {
|
||||
LambdaQueryWrapper<MedicaldesLight> wrapper = new LambdaQueryWrapper();
|
||||
if (StringUtils.isNotEmpty(type)){
|
||||
wrapper.eq(MedicaldesLight::getType,type);
|
||||
}
|
||||
List<MedicaldesLight> list = lightService.list(wrapper);
|
||||
return R.ok().put("result", list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 吴门之光列表
|
||||
*/
|
||||
@RequestMapping(path = "/lightListByPage")
|
||||
public R lightListByPage(@RequestBody Map map) {
|
||||
LambdaQueryWrapper<MedicaldesLight> wrapper = new LambdaQueryWrapper();
|
||||
if (map.containsKey("type")&&StringUtils.isNotEmpty(map.get("type").toString())){
|
||||
wrapper.eq(MedicaldesLight::getType,map.get("type"));
|
||||
}
|
||||
if (map.containsKey("name")&&StringUtils.isNotEmpty(map.get("name").toString())){
|
||||
wrapper.like(MedicaldesLight::getName,map.get("name"));
|
||||
}
|
||||
Page<MedicaldesLight> page = lightService.page(new Page<>(
|
||||
Long.parseLong(map.get("current").toString()), Long.parseLong(map.get("limit").toString())),wrapper);
|
||||
return R.ok().put("result", page);
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/getLightById")
|
||||
public R getLightById(String id) {
|
||||
return R.ok().put("result",lightService.getById(id));
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/saveOrUpdateLight")
|
||||
public R addLight(@RequestBody MedicaldesLight light) {
|
||||
lightService.saveOrUpdate(light);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@RequestMapping(path = "/delLight")
|
||||
public R delLight(String id) {
|
||||
lightService.removeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.book.entity.MedicaldesBook;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MedicaldesBookDao extends MPJBaseMapper<MedicaldesBook> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.book.entity.MedicaldesInherit;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MedicaldesInheritDao extends MPJBaseMapper<MedicaldesInherit> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.book.entity.MedicaldesInheritRelation;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MedicaldesInheritRelationDao extends MPJBaseMapper<MedicaldesInheritRelation> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.dao;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.peanut.modules.book.entity.MedicaldesLight;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MedicaldesLightDao extends MPJBaseMapper<MedicaldesLight> {
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@TableName("medicaldes_book")
|
||||
public class MedicaldesBook implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private BookEntity book;
|
||||
@TableField(exist = false)
|
||||
private com.peanut.modules.book.entity.SysDictDataEntity sysDictData;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
private Integer bookId;
|
||||
|
||||
/**
|
||||
* 书类型id,sys_dict_data-medicaldesBookType
|
||||
*/
|
||||
private Integer typeId;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("medicaldes_inherit")
|
||||
public class MedicaldesInherit implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer type;
|
||||
@TableField(exist = false)
|
||||
private Integer count;
|
||||
|
||||
/**
|
||||
* 传承人
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 超链接
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 图片
|
||||
*/
|
||||
private String img;
|
||||
|
||||
/**
|
||||
* 简介内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 所在城市
|
||||
*/
|
||||
private Integer cityId;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String provinceName;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("medicaldes_inherit_relation")
|
||||
public class MedicaldesInheritRelation implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
/**
|
||||
* 传承人id
|
||||
*/
|
||||
private Integer inheritId;
|
||||
|
||||
/**
|
||||
* 传承人类型id,sys_dict_data表inheritType
|
||||
*/
|
||||
private Integer typeId;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.peanut.modules.book.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@TableName("medicaldes_light")
|
||||
public class MedicaldesLight implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 类型1吴门之歌2巴山夜雨3吴门之徽
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.book.entity.MedicaldesBook;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface MedicaldesBookService extends IService<MedicaldesBook> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.book.entity.MedicaldesInheritRelation;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface MedicaldesInheritRelationService extends IService<MedicaldesInheritRelation> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.book.entity.MedicaldesInherit;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface MedicaldesInheritService extends IService<MedicaldesInherit> {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.peanut.modules.book.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.peanut.modules.book.entity.MedicaldesLight;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface MedicaldesLightService extends IService<MedicaldesLight> {
|
||||
}
|
||||
@@ -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.MedicaldesBookDao;
|
||||
import com.peanut.modules.book.entity.MedicaldesBook;
|
||||
import com.peanut.modules.book.service.MedicaldesBookService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MedicaldesBookServiceImpl extends ServiceImpl<MedicaldesBookDao, MedicaldesBook> implements MedicaldesBookService {
|
||||
}
|
||||
@@ -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.MedicaldesInheritRelationDao;
|
||||
import com.peanut.modules.book.entity.MedicaldesInheritRelation;
|
||||
import com.peanut.modules.book.service.MedicaldesInheritRelationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MedicaldesInheritRelationServiceImpl extends ServiceImpl<MedicaldesInheritRelationDao, MedicaldesInheritRelation> implements MedicaldesInheritRelationService {
|
||||
}
|
||||
@@ -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.MedicaldesInheritDao;
|
||||
import com.peanut.modules.book.entity.MedicaldesInherit;
|
||||
import com.peanut.modules.book.service.MedicaldesInheritService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MedicaldesInheritServiceImpl extends ServiceImpl<MedicaldesInheritDao, MedicaldesInherit> implements MedicaldesInheritService {
|
||||
}
|
||||
@@ -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.MedicaldesLightDao;
|
||||
import com.peanut.modules.book.entity.MedicaldesLight;
|
||||
import com.peanut.modules.book.service.MedicaldesLightService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class MedicaldesLightServiceImpl extends ServiceImpl<MedicaldesLightDao, MedicaldesLight> implements MedicaldesLightService {
|
||||
}
|
||||
Reference in New Issue
Block a user