From cd8a13e2d975aa028bb058e3bc9e9de282e94417 Mon Sep 17 00:00:00 2001 From: Saisai Liu <1374434128@qq.com> Date: Fri, 23 Feb 2024 21:26:11 +0800 Subject: [PATCH] =?UTF-8?q?book=E5=8D=95=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/constant/CacheConstants.java | 2 +- .../system/controller/BookInfoController.java | 153 ++++++++------- .../java/com/muyu/system/domain/BookInfo.java | 6 + .../muyu/system/mapper/BookInfoMapper.java | 61 +++++- .../muyu/system/service/BookInfoService.java | 17 -- .../muyu/system/service/IBookInfoService.java | 61 ++++++ .../service/impl/BookInfoServiceImpl.java | 119 ++++++++---- .../mapper/system/BookInfoMapper.xml | 174 ++++++++---------- 8 files changed, 349 insertions(+), 244 deletions(-) delete mode 100644 muyu-modules/muyu-system/src/main/java/com/muyu/system/service/BookInfoService.java create mode 100644 muyu-modules/muyu-system/src/main/java/com/muyu/system/service/IBookInfoService.java diff --git a/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/constant/CacheConstants.java b/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/constant/CacheConstants.java index 532c9f2..3ef4d91 100644 --- a/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/constant/CacheConstants.java +++ b/muyu-common/muyu-common-core/src/main/java/com/muyu/common/core/constant/CacheConstants.java @@ -24,7 +24,7 @@ public class CacheConstants { /** * 密码锁定时间,默认10(分钟) */ - public final static long PASSWORD_LOCK_TIME = 10; + public final static long PASSWORD_LOCK_TIME = 3; /** * 权限缓存前缀 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 index e01ac40..1a127e4 100644 --- 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 @@ -1,107 +1,104 @@ package com.muyu.system.controller; -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.core.web.page.TableDataInfo; +import java.util.List; +import javax.servlet.http.HttpServletResponse; +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.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.service.BookInfoService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; +import com.muyu.system.service.IBookInfoService; +import com.muyu.common.core.web.controller.BaseController; +import com.muyu.common.core.domain.Result; +import com.muyu.common.core.utils.poi.ExcelUtil; +import com.muyu.common.core.web.page.TableDataInfo; /** - * @ClassName BookInfoController - * @Description 描述 - * @Author SaiSai.Liu - * @Date 2024/2/22/0022 20:26 + * 【请填写功能名称】Controller + * + * @author muyu + * @date 2024-02-23 */ @RestController -@RequestMapping("/book") -public class BookInfoController extends BaseController { +@RequestMapping("/info") +public class BookInfoController extends BaseController +{ @Autowired - private BookInfoService bookInfoService; + private IBookInfoService bookInfoService; - @RequiresPermissions("system:book:list") + /** + * 查询【请填写功能名称】列表 + */ + @RequiresPermissions("system:info:list") @GetMapping("/list") - public Result> list (BookInfo book) { + public Result> list(BookInfo bookInfo) + { startPage(); - List list = bookInfoService.pageQuery(book); + List list = bookInfoService.selectBookInfoList(bookInfo); return getDataTable(list); } - @Log(title = "参数管理", businessType = BusinessType.EXPORT) - @RequiresPermissions("system:book:export") + /** + * 导出【请填写功能名称】列表 + */ + @RequiresPermissions("system:info:export") + @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT) @PostMapping("/export") - public void export (HttpServletResponse response, BookInfo book) { - List list = bookInfoService.pageQuery(book); + public void export(HttpServletResponse response, BookInfo bookInfo) + { + List list = bookInfoService.selectBookInfoList(bookInfo); ExcelUtil util = new ExcelUtil(BookInfo.class); - util.exportExcel(response, list, "参数数据"); + util.exportExcel(response, list, "【请填写功能名称】数据"); } /** - * 根据参数编号获取详细信息 + * 获取【请填写功能名称】详细信息 */ + @RequiresPermissions("system:info:query") @GetMapping(value = "/{id}") - public Result getInfo (@PathVariable Long id) { - return success(bookInfoService.getById(id)); + public Result getInfo(@PathVariable("id") Long id) + { + return success(bookInfoService.selectBookInfoById(id)); } + /** + * 新增【请填写功能名称】 + */ + @RequiresPermissions("system:info:add") + @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT) + @PostMapping + public Result add(@RequestBody BookInfo bookInfo) + { + return toAjax(bookInfoService.insertBookInfo(bookInfo)); + } -// /** -// * 新增参数配置 -// */ -// @RequiresPermissions("system:book:add") -// @Log(title = "参数管理", businessType = BusinessType.INSERT) -// @PostMapping -// public Result add (@Validated @RequestBody BookInfo book) { -// if (!bookInfoService.checkConfigKeyUnique(book)) { -// return error("新增参数'" + book.getConfigName() + "'失败,参数键名已存在"); -// } -// book.setCreateBy(SecurityUtils.getUsername()); -// return toAjax(bookInfoService.save(book)); -// } -// -// /** -// * 修改参数配置 -// */ -// @RequiresPermissions("system:book:edit") -// @Log(title = "参数管理", businessType = BusinessType.UPDATE) -// @PutMapping -// public Result edit (@Validated @RequestBody BookInfo book) { -// if (!bookInfoService.checkConfigKeyUnique(book)) { -// return error("修改参数'" + book.getConfigName() + "'失败,参数键名已存在"); -// } -// book.setUpdateBy(SecurityUtils.getUsername()); -// return toAjax(bookInfoService.updateById(book)); -// } -// -// /** -// * 删除参数配置 -// */ -// @RequiresPermissions("system:book:remove") -// @Log(title = "参数管理", businessType = BusinessType.DELETE) -// @DeleteMapping("/{configIds}") -// public Result remove (@PathVariable Long[] configIds) { -// bookInfoService.removeBatchByIds(Arrays.asList(configIds)); -// return success(); -// } -// -// /** -// * 刷新参数缓存 -// */ -// @RequiresPermissions("system:book:remove") -// @Log(title = "参数管理", businessType = BusinessType.CLEAN) -// @DeleteMapping("/refreshCache") -// public Result refreshCache () { -// bookInfoService.resetConfigCache(); -// return success(); -// } - + /** + * 修改【请填写功能名称】 + */ + @RequiresPermissions("system:info:edit") + @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE) + @PutMapping + public Result edit(@RequestBody BookInfo bookInfo) + { + return toAjax(bookInfoService.updateBookInfo(bookInfo)); + } + /** + * 删除【请填写功能名称】 + */ + @RequiresPermissions("system:info:remove") + @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public Result remove(@PathVariable Long[] ids) + { + return toAjax(bookInfoService.deleteBookInfoByIds(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 index 61b25b0..7d3afbd 100644 --- 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 @@ -49,6 +49,12 @@ public class BookInfo extends BaseEntity { @Excel(name="书名") private String title; + /** + * 书名 + */ + @Excel(name="书名") + private String remak; + /** * 类型 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 index bd0699a..3aa02c0 100644 --- 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 @@ -1,14 +1,61 @@ package com.muyu.system.mapper; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import java.util.List; import com.muyu.system.domain.BookInfo; -import com.muyu.system.domain.SysConfig; /** - * @ClassName BookInfoMapper - * @Description 描述 - * @Author SaiSai.Liu - * @Date 2024/2/22/0022 20:52 + * 【请填写功能名称】Mapper接口 + * + * @author muyu + * @date 2024-02-23 */ -public interface BookInfoMapper extends BaseMapper { +public interface BookInfoMapper +{ + /** + * 查询【请填写功能名称】 + * + * @param id 【请填写功能名称】主键 + * @return 【请填写功能名称】 + */ + public BookInfo selectBookInfoById(Long id); + + /** + * 查询【请填写功能名称】列表 + * + * @param bookInfo 【请填写功能名称】 + * @return 【请填写功能名称】集合 + */ + public List selectBookInfoList(BookInfo bookInfo); + + /** + * 新增【请填写功能名称】 + * + * @param bookInfo 【请填写功能名称】 + * @return 结果 + */ + public int insertBookInfo(BookInfo bookInfo); + + /** + * 修改【请填写功能名称】 + * + * @param bookInfo 【请填写功能名称】 + * @return 结果 + */ + public int updateBookInfo(BookInfo bookInfo); + + /** + * 删除【请填写功能名称】 + * + * @param id 【请填写功能名称】主键 + * @return 结果 + */ + public int deleteBookInfoById(Long id); + + /** + * 批量删除【请填写功能名称】 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteBookInfoByIds(Long[] ids); } 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 01e2f57..0000000 --- a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/BookInfoService.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.muyu.system.service; - -import com.muyu.system.domain.BookInfo; - -import java.util.List; - -/** - * @ClassName BookInfoService - * @Description 描述 - * @Author SaiSai.Liu - * @Date 2024/2/22/0022 20:27 - */ -public interface BookInfoService { - List pageQuery(BookInfo book); - - String getById(Long id); -} diff --git a/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/IBookInfoService.java b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/IBookInfoService.java new file mode 100644 index 0000000..3501d98 --- /dev/null +++ b/muyu-modules/muyu-system/src/main/java/com/muyu/system/service/IBookInfoService.java @@ -0,0 +1,61 @@ +package com.muyu.system.service; + +import java.util.List; +import com.muyu.system.domain.BookInfo; + +/** + * 【请填写功能名称】Service接口 + * + * @author muyu + * @date 2024-02-23 + */ +public interface IBookInfoService +{ + /** + * 查询【请填写功能名称】 + * + * @param id 【请填写功能名称】主键 + * @return 【请填写功能名称】 + */ + public BookInfo selectBookInfoById(Long id); + + /** + * 查询【请填写功能名称】列表 + * + * @param bookInfo 【请填写功能名称】 + * @return 【请填写功能名称】集合 + */ + public List selectBookInfoList(BookInfo bookInfo); + + /** + * 新增【请填写功能名称】 + * + * @param bookInfo 【请填写功能名称】 + * @return 结果 + */ + public int insertBookInfo(BookInfo bookInfo); + + /** + * 修改【请填写功能名称】 + * + * @param bookInfo 【请填写功能名称】 + * @return 结果 + */ + public int updateBookInfo(BookInfo bookInfo); + + /** + * 批量删除【请填写功能名称】 + * + * @param ids 需要删除的【请填写功能名称】主键集合 + * @return 结果 + */ + public int deleteBookInfoByIds(Long[] ids); + + /** + * 删除【请填写功能名称】信息 + * + * @param id 【请填写功能名称】主键 + * @return 结果 + */ + public int deleteBookInfoById(Long id); +} 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 index 166f0c9..b653cb3 100644 --- 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 @@ -1,55 +1,96 @@ package com.muyu.system.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.muyu.common.core.utils.StringUtils; -import com.muyu.common.redis.service.RedisService; -import com.muyu.system.domain.BookInfo; -import com.muyu.system.domain.BookInfo; -import com.muyu.system.mapper.BookInfoMapper; -import com.muyu.system.service.BookInfoService; +import java.util.List; +import com.muyu.common.core.utils.DateUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; - -import java.util.Date; -import java.util.List; -import java.util.Objects; +import com.muyu.system.mapper.BookInfoMapper; +import com.muyu.system.domain.BookInfo; +import com.muyu.system.service.IBookInfoService; /** - * @ClassName BookInfoServiceImpl - * @Description 描述 - * @Author SaiSai.Liu - * @Date 2024/2/22/0022 20:27 + * 【请填写功能名称】Service业务层处理 + * + * @author muyu + * @date 2024-02-23 */ @Service -public class BookInfoServiceImpl extends ServiceImpl - implements BookInfoService { +public class BookInfoServiceImpl implements IBookInfoService +{ @Autowired - private RedisService redisService; + private BookInfoMapper bookInfoMapper; + /** + * 查询【请填写功能名称】 + * + * @param id 【请填写功能名称】主键 + * @return 【请填写功能名称】 + */ @Override - public List pageQuery (BookInfo book) { - LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - if (StringUtils.isNotEmpty(book.getTitle())){ - queryWrapper.like(BookInfo::getTitle, book.getTitle()); - } - if (StringUtils.isNotEmpty(book.getType())){ - queryWrapper.like(BookInfo::getType, book.getType()); - } - Object beginTime = book.getParams().get("beginTime"); - if (Objects.nonNull(beginTime) && beginTime instanceof Date beginDate){ - queryWrapper.gt(BookInfo::getGrounding, beginDate); - } - Object endTime = book.getParams().get("endTime"); - if (Objects.nonNull(endTime) && endTime instanceof Date endDate){ - queryWrapper.lt(BookInfo::getGrounding, endDate); - } - return this.list(queryWrapper); + public BookInfo selectBookInfoById(Long id) + { + return bookInfoMapper.selectBookInfoById(id); } - + /** + * 查询【请填写功能名称】列表 + * + * @param bookInfo 【请填写功能名称】 + * @return 【请填写功能名称】 + */ @Override - public String getById(Long id) { - return null; + public List selectBookInfoList(BookInfo bookInfo) + { + return bookInfoMapper.selectBookInfoList(bookInfo); + } + + /** + * 新增【请填写功能名称】 + * + * @param bookInfo 【请填写功能名称】 + * @return 结果 + */ + @Override + public int insertBookInfo(BookInfo bookInfo) + { + bookInfo.setCreateTime(DateUtils.getNowDate()); + return bookInfoMapper.insertBookInfo(bookInfo); + } + + /** + * 修改【请填写功能名称】 + * + * @param bookInfo 【请填写功能名称】 + * @return 结果 + */ + @Override + public int updateBookInfo(BookInfo bookInfo) + { + bookInfo.setUpdateTime(DateUtils.getNowDate()); + return bookInfoMapper.updateBookInfo(bookInfo); + } + + /** + * 批量删除【请填写功能名称】 + * + * @param ids 需要删除的【请填写功能名称】主键 + * @return 结果 + */ + @Override + public int deleteBookInfoByIds(Long[] ids) + { + return bookInfoMapper.deleteBookInfoByIds(ids); + } + + /** + * 删除【请填写功能名称】信息 + * + * @param id 【请填写功能名称】主键 + * @return 结果 + */ + @Override + public int deleteBookInfoById(Long id) + { + return bookInfoMapper.deleteBookInfoById(id); } } 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 index 6af1cb7..fa8817d 100644 --- a/muyu-modules/muyu-system/src/main/resources/mapper/system/BookInfoMapper.xml +++ b/muyu-modules/muyu-system/src/main/resources/mapper/system/BookInfoMapper.xml @@ -5,128 +5,98 @@ - - - - - - - - - - - + + + + + + + + + + + + - select id, - title, - author, - type, - images, - remak, - content, - grounding, - create_by, - create_time - from book_info + select id, title, author, type, images, remak, content, grounding, create_by, create_time, update_time, update_by from book_info - - - - - and id = #{id} - - - and config_key = #{configKey} - - - - - - - - - AND config_name like concat('%', #{configName}, '%') - - - AND config_type = #{configType} - - - AND config_key like concat('%', #{configKey}, '%') - - - and date_format(create_time,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') - - - and date_format(create_time,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') - + and title = #{title} + and author = #{author} + and type = #{type} + and images = #{images} + and remak = #{remak} + and content = #{content} + and grounding = #{grounding} - where id = #{id} - - - - - insert into sys_config ( - config_name, - config_key, - config_value, - config_type, - create_by, - remark, - create_time - )values( - #{configName}, - #{configKey}, - #{configValue}, - #{configType}, - #{createBy}, - #{remark}, - sysdate() - ) + + insert into book_info + + title, + author, + type, + images, + remak, + content, + grounding, + create_by, + create_time, + update_time, + update_by, + + + #{title}, + #{author}, + #{type}, + #{images}, + #{remak}, + #{content}, + #{grounding}, + #{createBy}, + #{createTime}, + #{updateTime}, + #{updateBy}, + - - - update sys_config - - config_name = #{configName}, - config_key = #{configKey}, - config_value = #{configValue}, - config_type = #{configType}, - update_by = #{updateBy}, - remark = #{remark}, - update_time = sysdate() - - where config_id = #{configId} + + update book_info + + title = #{title}, + author = #{author}, + type = #{type}, + images = #{images}, + remak = #{remak}, + content = #{content}, + grounding = #{grounding}, + create_by = #{createBy}, + create_time = now(), + update_time = #{updateTime}, + update_by = #{updateBy}, + + where id = #{id} - - delete - from sys_config - where config_id = #{configId} + + delete from book_info where id = #{id} - - delete from sys_config where config_id in - - #{configId} + + delete from book_info where id in + + #{id} -