From b156eedfa2f8b82e4fb45593cbda4f5bfee6b236 Mon Sep 17 00:00:00 2001 From: DongZeLiang <2746733890@qq.com> Date: Tue, 27 Feb 2024 10:51:49 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4book=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/controller/BookInfoController.java | 116 ------------------ .../java/com/muyu/system/domain/BookInfo.java | 113 ----------------- .../system/domain/req/BookInfoEditReq.java | 53 -------- .../system/domain/req/BookInfoQueryReq.java | 40 ------ .../system/domain/req/BookInfoSaveReq.java | 64 ---------- .../muyu/system/mapper/BookInfoMapper.java | 15 --- .../muyu/system/service/BookInfoService.java | 22 ---- .../service/impl/BookInfoServiceImpl.java | 56 --------- .../mapper/system/BookInfoMapper.xml | 25 ---- 9 files changed, 504 deletions(-) delete mode 100644 muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/BookInfoController.java delete mode 100644 muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/BookInfo.java delete mode 100644 muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoEditReq.java delete mode 100644 muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoQueryReq.java delete mode 100644 muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoSaveReq.java delete mode 100644 muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/BookInfoMapper.java delete mode 100644 muyu-modules/muyu-system/src/main/java/com/muyu/system/service/BookInfoService.java delete mode 100644 muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/BookInfoServiceImpl.java delete mode 100644 muyu-modules/muyu-system/src/main/resources/mapper/system/BookInfoMapper.xml diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/BookInfoController.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/BookInfoController.java deleted file mode 100644 index e9c8b3b..0000000 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/controller/BookInfoController.java +++ /dev/null @@ -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> list(BookInfoQueryReq bookInfoQueryReq) { - startPage(); - List 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 list = bookInfoService.list(bookInfo); - ExcelUtil util = new ExcelUtil(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 getInfo(@PathVariable("id") Long id) { - return Result.success(bookInfoService.getById(id)); - } - - /** - * 新增书籍信息 - */ - @RequiresPermissions("system:book:add") - @Log(title = "书籍信息", businessType = BusinessType.INSERT) - @PostMapping - @ApiOperation("新增书籍信息") - public Result 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 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 remove(@PathVariable List ids) { - return toAjax(bookInfoService.removeBatchByIds(ids)); - } -} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/BookInfo.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/BookInfo.java deleted file mode 100644 index c59ea73..0000000 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/BookInfo.java +++ /dev/null @@ -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(); - } - -} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoEditReq.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoEditReq.java deleted file mode 100644 index 6b28ab5..0000000 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoEditReq.java +++ /dev/null @@ -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; - -} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoQueryReq.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoQueryReq.java deleted file mode 100644 index 067cbbf..0000000 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoQueryReq.java +++ /dev/null @@ -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; - -} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoSaveReq.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoSaveReq.java deleted file mode 100644 index 405dd93..0000000 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/domain/req/BookInfoSaveReq.java +++ /dev/null @@ -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; - -} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/BookInfoMapper.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/BookInfoMapper.java deleted file mode 100644 index f836e0f..0000000 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/mapper/BookInfoMapper.java +++ /dev/null @@ -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 { - -} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/BookInfoService.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/BookInfoService.java deleted file mode 100644 index 6081c05..0000000 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/BookInfoService.java +++ /dev/null @@ -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 { - /** - * 查询书籍信息列表 - * - * @param bookInfo 书籍信息 - * @return 书籍信息集合 - */ - public List list(BookInfo bookInfo); - -} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/BookInfoServiceImpl.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/BookInfoServiceImpl.java deleted file mode 100644 index 313a5be..0000000 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/impl/BookInfoServiceImpl.java +++ /dev/null @@ -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 implements BookInfoService { - - /** - * 查询书籍信息列表 - * - * @param bookInfo 书籍信息 - * @return 书籍信息 - */ - @Override - public List list(BookInfo bookInfo) { - LambdaQueryWrapper 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); - } -} diff --git a/muyu-modules/muyu-system/src/main/resources/mapper/system/BookInfoMapper.xml b/muyu-modules/muyu-system/src/main/resources/mapper/system/BookInfoMapper.xml deleted file mode 100644 index 6c91fc3..0000000 --- a/muyu-modules/muyu-system/src/main/resources/mapper/system/BookInfoMapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - select id, title, author, type, images, content, shel_time, remark, create_time, create_by, update_by, update_time from book_info - -