移除book代码
parent
49845c93b5
commit
b156eedfa2
|
@ -1,116 +0,0 @@
|
|||
package com.muyu.system.controller;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.muyu.common.security.utils.SecurityUtils;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
import com.muyu.common.log.annotation.Log;
|
||||
import com.muyu.common.log.enums.BusinessType;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.system.domain.BookInfo;
|
||||
import com.muyu.system.domain.req.BookInfoQueryReq;
|
||||
import com.muyu.system.domain.req.BookInfoSaveReq;
|
||||
import com.muyu.system.domain.req.BookInfoEditReq;
|
||||
import com.muyu.system.service.BookInfoService;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 书籍信息Controller
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-02-26
|
||||
*/
|
||||
@Api(tags = "书籍信息")
|
||||
@RestController
|
||||
@RequestMapping("/book")
|
||||
public class BookInfoController extends BaseController {
|
||||
@Autowired
|
||||
private BookInfoService bookInfoService;
|
||||
|
||||
/**
|
||||
* 查询书籍信息列表
|
||||
*/
|
||||
@ApiOperation("获取书籍信息列表")
|
||||
@RequiresPermissions("system:book:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<BookInfo>> list(BookInfoQueryReq bookInfoQueryReq) {
|
||||
startPage();
|
||||
List<BookInfo> list = bookInfoService.list(BookInfo.queryBuild(bookInfoQueryReq));
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出书籍信息列表
|
||||
*/
|
||||
@ApiOperation("导出书籍信息列表")
|
||||
@RequiresPermissions("system:book:export")
|
||||
@Log(title = "书籍信息", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BookInfo bookInfo) {
|
||||
List<BookInfo> list = bookInfoService.list(bookInfo);
|
||||
ExcelUtil<BookInfo> util = new ExcelUtil<BookInfo>(BookInfo.class);
|
||||
util.exportExcel(response, list, "书籍信息数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取书籍信息详细信息
|
||||
*/
|
||||
@ApiOperation("获取书籍信息详细信息")
|
||||
@RequiresPermissions("system:book:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = Long.class)
|
||||
public Result<BookInfo> getInfo(@PathVariable("id") Long id) {
|
||||
return Result.success(bookInfoService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增书籍信息
|
||||
*/
|
||||
@RequiresPermissions("system:book:add")
|
||||
@Log(title = "书籍信息", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@ApiOperation("新增书籍信息")
|
||||
public Result<String> add(@RequestBody BookInfoSaveReq bookInfoSaveReq) {
|
||||
BookInfo bookInfo = BookInfo.saveBuild(bookInfoSaveReq);
|
||||
bookInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
bookInfo.setCreateTime(new Date());
|
||||
return toAjax(bookInfoService.save(bookInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改书籍信息
|
||||
*/
|
||||
@RequiresPermissions("system:book:edit")
|
||||
@Log(title = "书籍信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/{id}")
|
||||
@ApiOperation("修改书籍信息")
|
||||
public Result<String> edit(@PathVariable Long id, @RequestBody BookInfoEditReq bookInfoEditReq) {
|
||||
return toAjax(bookInfoService.updateById(BookInfo.editBuild(id,bookInfoEditReq)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除书籍信息
|
||||
*/
|
||||
@RequiresPermissions("system:book:remove")
|
||||
@Log(title = "书籍信息", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@ApiOperation("删除书籍信息")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true, dataType = "Long", paramType = "path", dataTypeClass = String.class, example = "1,2,3,4")
|
||||
public Result<String> remove(@PathVariable List<Long> ids) {
|
||||
return toAjax(bookInfoService.removeBatchByIds(ids));
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
package com.muyu.system.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.system.domain.req.BookInfoQueryReq;
|
||||
import com.muyu.system.domain.req.BookInfoSaveReq;
|
||||
import com.muyu.system.domain.req.BookInfoEditReq;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 书籍信息对象 book_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-02-26
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("book_info")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "BookInfo", description = "书籍信息")
|
||||
public class BookInfo extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(value = "id",type = IdType.AUTO)
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private Long id;
|
||||
|
||||
/** 书籍名称 */
|
||||
@Excel(name = "书籍名称")
|
||||
@ApiModelProperty(name = "书籍名称", value = "书籍名称", required = true)
|
||||
private String title;
|
||||
|
||||
/** 作者 */
|
||||
@Excel(name = "作者")
|
||||
@ApiModelProperty(name = "作者", value = "作者", required = true)
|
||||
private String author;
|
||||
|
||||
/** 类型 */
|
||||
@Excel(name = "类型")
|
||||
@ApiModelProperty(name = "类型", value = "类型", required = true)
|
||||
private String type;
|
||||
|
||||
/** 图片 */
|
||||
@Excel(name = "图片")
|
||||
@ApiModelProperty(name = "图片", value = "图片", required = true)
|
||||
private String images;
|
||||
|
||||
/** 书籍描述 */
|
||||
@Excel(name = "书籍描述")
|
||||
@ApiModelProperty(name = "书籍描述", value = "书籍描述")
|
||||
private String content;
|
||||
|
||||
/** 上架时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "上架时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "上架时间", value = "上架时间", required = true)
|
||||
private Date shelTime;
|
||||
|
||||
/**
|
||||
* 查询构造器
|
||||
*/
|
||||
public static BookInfo queryBuild( BookInfoQueryReq bookInfoQueryReq){
|
||||
return BookInfo.builder()
|
||||
.title(bookInfoQueryReq.getTitle())
|
||||
.author(bookInfoQueryReq.getAuthor())
|
||||
.type(bookInfoQueryReq.getType())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加构造器
|
||||
*/
|
||||
public static BookInfo saveBuild(BookInfoSaveReq bookInfoSaveReq){
|
||||
return BookInfo.builder()
|
||||
.title(bookInfoSaveReq.getTitle())
|
||||
.author(bookInfoSaveReq.getAuthor())
|
||||
.type(bookInfoSaveReq.getType())
|
||||
.images(bookInfoSaveReq.getImages())
|
||||
.content(bookInfoSaveReq.getContent())
|
||||
.shelTime(bookInfoSaveReq.getShelTime())
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改构造器
|
||||
*/
|
||||
public static BookInfo editBuild(Long id, BookInfoEditReq bookInfoEditReq){
|
||||
return BookInfo.builder()
|
||||
.id(id)
|
||||
.title(bookInfoEditReq.getTitle())
|
||||
.author(bookInfoEditReq.getAuthor())
|
||||
.type(bookInfoEditReq.getType())
|
||||
.images(bookInfoEditReq.getImages())
|
||||
.content(bookInfoEditReq.getContent())
|
||||
.shelTime(bookInfoEditReq.getShelTime())
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
package com.muyu.system.domain.req;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 书籍信息对象 book_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-02-26
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "BookInfoEditReq", description = "书籍信息")
|
||||
public class BookInfoEditReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 书籍名称 */
|
||||
@ApiModelProperty(name = "书籍名称", value = "书籍名称", required = true)
|
||||
private String title;
|
||||
|
||||
/** 作者 */
|
||||
@ApiModelProperty(name = "作者", value = "作者", required = true)
|
||||
private String author;
|
||||
|
||||
/** 类型 */
|
||||
@ApiModelProperty(name = "类型", value = "类型", required = true)
|
||||
private String type;
|
||||
|
||||
/** 图片 */
|
||||
@ApiModelProperty(name = "图片", value = "图片", required = true)
|
||||
private String images;
|
||||
|
||||
/** 书籍描述 */
|
||||
@ApiModelProperty(name = "书籍描述", value = "书籍描述")
|
||||
private String content;
|
||||
|
||||
/** 上架时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(name = "上架时间", value = "上架时间", required = true)
|
||||
private Date shelTime;
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package com.muyu.system.domain.req;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 书籍信息对象 book_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-02-26
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "BookInfoQueryReq", description = "书籍信息")
|
||||
public class BookInfoQueryReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 书籍名称 */
|
||||
@ApiModelProperty(name = "书籍名称", value = "书籍名称")
|
||||
private String title;
|
||||
|
||||
/** 作者 */
|
||||
@ApiModelProperty(name = "作者", value = "作者")
|
||||
private String author;
|
||||
|
||||
/** 类型 */
|
||||
@ApiModelProperty(name = "类型", value = "类型")
|
||||
private String type;
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
package com.muyu.system.domain.req;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import io.swagger.annotations.*;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 书籍信息对象 book_info
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-02-26
|
||||
*/
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@ApiModel(value = "BookInfoSaveReq", description = "书籍信息")
|
||||
public class BookInfoSaveReq extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
|
||||
@ApiModelProperty(name = "主键", value = "主键")
|
||||
private Long id;
|
||||
|
||||
/** 书籍名称 */
|
||||
|
||||
@ApiModelProperty(name = "书籍名称", value = "书籍名称", required = true)
|
||||
private String title;
|
||||
|
||||
/** 作者 */
|
||||
|
||||
@ApiModelProperty(name = "作者", value = "作者", required = true)
|
||||
private String author;
|
||||
|
||||
/** 类型 */
|
||||
|
||||
@ApiModelProperty(name = "类型", value = "类型", required = true)
|
||||
private String type;
|
||||
|
||||
/** 图片 */
|
||||
|
||||
@ApiModelProperty(name = "图片", value = "图片", required = true)
|
||||
private String images;
|
||||
|
||||
/** 书籍描述 */
|
||||
|
||||
@ApiModelProperty(name = "书籍描述", value = "书籍描述")
|
||||
private String content;
|
||||
|
||||
/** 上架时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
|
||||
@ApiModelProperty(name = "上架时间", value = "上架时间", required = true)
|
||||
private Date shelTime;
|
||||
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package com.muyu.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.system.domain.BookInfo;
|
||||
|
||||
/**
|
||||
* 书籍信息Mapper接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-02-26
|
||||
*/
|
||||
public interface BookInfoMapper extends BaseMapper<BookInfo> {
|
||||
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package com.muyu.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.system.domain.BookInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 书籍信息Service接口
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-02-26
|
||||
*/
|
||||
public interface BookInfoService extends IService<BookInfo> {
|
||||
/**
|
||||
* 查询书籍信息列表
|
||||
*
|
||||
* @param bookInfo 书籍信息
|
||||
* @return 书籍信息集合
|
||||
*/
|
||||
public List<BookInfo> list(BookInfo bookInfo);
|
||||
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
package com.muyu.system.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.common.core.utils.ObjUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.system.mapper.BookInfoMapper;
|
||||
import com.muyu.system.domain.BookInfo;
|
||||
import com.muyu.system.service.BookInfoService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
|
||||
/**
|
||||
* 书籍信息Service业务层处理
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-02-26
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BookInfoServiceImpl extends ServiceImpl<BookInfoMapper, BookInfo> implements BookInfoService {
|
||||
|
||||
/**
|
||||
* 查询书籍信息列表
|
||||
*
|
||||
* @param bookInfo 书籍信息
|
||||
* @return 书籍信息
|
||||
*/
|
||||
@Override
|
||||
public List<BookInfo> list(BookInfo bookInfo) {
|
||||
LambdaQueryWrapper<BookInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
|
||||
if (ObjUtils.notNull(bookInfo.getTitle())){
|
||||
queryWrapper.eq(BookInfo::getTitle, bookInfo.getTitle());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(bookInfo.getAuthor())){
|
||||
queryWrapper.eq(BookInfo::getAuthor, bookInfo.getAuthor());
|
||||
}
|
||||
|
||||
if (ObjUtils.notNull(bookInfo.getType())){
|
||||
queryWrapper.eq(BookInfo::getType, bookInfo.getType());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.muyu.system.mapper.BookInfoMapper">
|
||||
|
||||
<resultMap type="com.muyu.system.domain.BookInfo" id="BookInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="title" column="title" />
|
||||
<result property="author" column="author" />
|
||||
<result property="type" column="type" />
|
||||
<result property="images" column="images" />
|
||||
<result property="content" column="content" />
|
||||
<result property="shelTime" column="shel_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBookInfoVo">
|
||||
select id, title, author, type, images, content, shel_time, remark, create_time, create_by, update_by, update_time from book_info
|
||||
</sql>
|
||||
</mapper>
|
Loading…
Reference in New Issue