From dca26f239eb286ff4333132f797d5cff39fb926e Mon Sep 17 00:00:00 2001 From: huangzhen <867217663@qq.com> Date: 星期三, 13 九月 2023 16:07:25 +0800 Subject: [PATCH] 文件增加批量保存功能 --- ruoyi-file/src/main/java/com/ruoyi/file/service/impl/AttachmentServiceImpl.java | 7 +++++++ ruoyi-file/src/main/java/com/ruoyi/file/service/AttachmentService.java | 2 ++ ruoyi-file/src/main/java/com/ruoyi/file/service/impl/AttachmentInfoServiceImpl.java | 2 +- 3 files changed, 10 insertions(+), 1 deletions(-) diff --git a/ruoyi-file/src/main/java/com/ruoyi/file/service/AttachmentService.java b/ruoyi-file/src/main/java/com/ruoyi/file/service/AttachmentService.java index 363b6a5..555fa15 100644 --- a/ruoyi-file/src/main/java/com/ruoyi/file/service/AttachmentService.java +++ b/ruoyi-file/src/main/java/com/ruoyi/file/service/AttachmentService.java @@ -31,4 +31,6 @@ void downloadForStream(HttpServletResponse response, String key); void downloadById(HttpServletResponse response, HttpServletRequest request, Long id); + + void saveBatch(List<AttachmentInfo> attachmentInfo); } diff --git a/ruoyi-file/src/main/java/com/ruoyi/file/service/impl/AttachmentInfoServiceImpl.java b/ruoyi-file/src/main/java/com/ruoyi/file/service/impl/AttachmentInfoServiceImpl.java index 6e56f53..7f37906 100644 --- a/ruoyi-file/src/main/java/com/ruoyi/file/service/impl/AttachmentInfoServiceImpl.java +++ b/ruoyi-file/src/main/java/com/ruoyi/file/service/impl/AttachmentInfoServiceImpl.java @@ -58,7 +58,7 @@ AttachmentInfo attachmentInfo = new AttachmentInfo(); attachmentInfo.setId(id); attachmentInfo.setUpdateTime(new Date()); - //attachmentInfo.setUpdateBy(SecurityUtils.getUsername()); + attachmentInfo.setUpdateBy(SecurityUtils.getUsername()); attachmentInfo.setDelFlag(1); attachmentInfoMapper.updateById(attachmentInfo); } diff --git a/ruoyi-file/src/main/java/com/ruoyi/file/service/impl/AttachmentServiceImpl.java b/ruoyi-file/src/main/java/com/ruoyi/file/service/impl/AttachmentServiceImpl.java index 91ce116..b0074bb 100644 --- a/ruoyi-file/src/main/java/com/ruoyi/file/service/impl/AttachmentServiceImpl.java +++ b/ruoyi-file/src/main/java/com/ruoyi/file/service/impl/AttachmentServiceImpl.java @@ -401,4 +401,11 @@ throw new ServiceException("文件不存在"); } } + + @Override + public void saveBatch(List<AttachmentInfo> attachmentInfo) { + boolean saveBatch = attachmentInfoService.saveBatch(attachmentInfo); + if (!saveBatch) + throw new ServiceException("文件批量保存失败"); + } } -- Gitblit v1.9.2