From 085b61c2ab95f4f4db8db1ed5d0bf4ebc8fe2798 Mon Sep 17 00:00:00 2001 From: Chopper711 Date: Mon, 27 May 2024 14:45:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8D=95=E4=B8=AA=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=B9=E5=88=A0=E9=99=A4=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E5=A4=84=E7=90=86=EF=BC=8Cpom.xml=20=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E8=BF=90=E8=A1=8C=E7=8E=AF=E5=A2=83=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=EF=BC=8C=E5=BC=80=E5=8F=91=E6=B5=8B=E8=AF=95=E7=8E=AF?= =?UTF-8?q?=E5=A2=83=20jdk22=20=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E7=BC=96=E8=AF=91=201.8=E7=89=88=E6=9C=AC=20jdk=20=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../file/serviceimpl/FileServiceImpl.java | 48 +++++++++++-------- pom.xml | 11 +++++ 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/framework/src/main/java/cn/lili/modules/file/serviceimpl/FileServiceImpl.java b/framework/src/main/java/cn/lili/modules/file/serviceimpl/FileServiceImpl.java index c23ad22d..b860aa9f 100644 --- a/framework/src/main/java/cn/lili/modules/file/serviceimpl/FileServiceImpl.java +++ b/framework/src/main/java/cn/lili/modules/file/serviceimpl/FileServiceImpl.java @@ -4,8 +4,6 @@ import cn.hutool.core.text.CharSequenceUtil; import cn.lili.common.enums.ResultCode; import cn.lili.common.exception.ServiceException; import cn.lili.common.security.AuthUser; -import cn.lili.common.vo.PageVO; -import cn.lili.common.vo.SearchVO; import cn.lili.modules.file.entity.File; import cn.lili.modules.file.entity.dto.FileOwnerDTO; import cn.lili.modules.file.mapper.FileMapper; @@ -15,11 +13,10 @@ import cn.lili.mybatis.util.PageUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - import java.util.ArrayList; import java.util.List; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; /** * 文件管理业务层实现 @@ -42,7 +39,7 @@ public class FileServiceImpl extends ServiceImpl implements Fi List files = this.list(queryWrapper); List keys = new ArrayList<>(); files.forEach(item -> keys.add(item.getFileKey())); - if(!keys.isEmpty()) { + if (!keys.isEmpty()) { filePluginFactory.filePlugin().deleteFile(keys); } this.remove(queryWrapper); @@ -56,7 +53,9 @@ public class FileServiceImpl extends ServiceImpl implements Fi List files = this.list(queryWrapper); List keys = new ArrayList<>(); files.forEach(item -> keys.add(item.getFileKey())); - filePluginFactory.filePlugin().deleteFile(keys); + if (!keys.isEmpty()) { + filePluginFactory.filePlugin().deleteFile(keys); + } this.remove(queryWrapper); } @@ -90,26 +89,33 @@ public class FileServiceImpl extends ServiceImpl implements Fi public IPage customerPage(FileOwnerDTO fileOwnerDTO) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getName()), File::getName, fileOwnerDTO.getName()) - .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getOwnerName()), File::getOwnerName, fileOwnerDTO.getOwnerName()) - .eq(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileDirectoryId()),File::getFileDirectoryId, fileOwnerDTO.getFileDirectoryId()) - .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileKey()), File::getFileKey, fileOwnerDTO.getFileKey()) - .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileType()), File::getFileType, fileOwnerDTO.getFileType()) - .between(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getStartDate()) && CharSequenceUtil.isNotEmpty(fileOwnerDTO.getEndDate()), - File::getCreateTime, fileOwnerDTO.getStartDate(), fileOwnerDTO.getEndDate()); + .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getOwnerName()), File::getOwnerName, + fileOwnerDTO.getOwnerName()) + .eq(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileDirectoryId()), File::getFileDirectoryId, + fileOwnerDTO.getFileDirectoryId()) + .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileKey()), File::getFileKey, fileOwnerDTO.getFileKey()) + .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileType()), File::getFileType, + fileOwnerDTO.getFileType()).between( + CharSequenceUtil.isNotEmpty(fileOwnerDTO.getStartDate()) && CharSequenceUtil.isNotEmpty( + fileOwnerDTO.getEndDate()), File::getCreateTime, fileOwnerDTO.getStartDate(), + fileOwnerDTO.getEndDate()); return this.page(PageUtil.initPage(fileOwnerDTO), queryWrapper); } @Override public IPage customerPageOwner(FileOwnerDTO fileOwnerDTO) { LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); - queryWrapper.eq(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getOwnerId()), File::getOwnerId, fileOwnerDTO.getOwnerId()) - .eq(File::getUserEnums, fileOwnerDTO.getUserEnums()) - .eq(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileDirectoryId()),File::getFileDirectoryId, fileOwnerDTO.getFileDirectoryId()) - .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getName()), File::getName, fileOwnerDTO.getName()) - .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileKey()), File::getFileKey, fileOwnerDTO.getFileKey()) - .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileType()), File::getFileType, fileOwnerDTO.getFileType()) - .between(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getStartDate()) && CharSequenceUtil.isNotEmpty(fileOwnerDTO.getEndDate()), - File::getCreateTime, fileOwnerDTO.getStartDate(), fileOwnerDTO.getEndDate()); + queryWrapper.eq(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getOwnerId()), File::getOwnerId, + fileOwnerDTO.getOwnerId()).eq(File::getUserEnums, fileOwnerDTO.getUserEnums()) + .eq(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileDirectoryId()), File::getFileDirectoryId, + fileOwnerDTO.getFileDirectoryId()) + .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getName()), File::getName, fileOwnerDTO.getName()) + .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileKey()), File::getFileKey, fileOwnerDTO.getFileKey()) + .like(CharSequenceUtil.isNotEmpty(fileOwnerDTO.getFileType()), File::getFileType, + fileOwnerDTO.getFileType()).between( + CharSequenceUtil.isNotEmpty(fileOwnerDTO.getStartDate()) && CharSequenceUtil.isNotEmpty( + fileOwnerDTO.getEndDate()), File::getCreateTime, fileOwnerDTO.getStartDate(), + fileOwnerDTO.getEndDate()); return this.page(PageUtil.initPage(fileOwnerDTO), queryWrapper); } } \ No newline at end of file diff --git a/pom.xml b/pom.xml index 578abc28..5f1716ee 100644 --- a/pom.xml +++ b/pom.xml @@ -80,6 +80,17 @@ + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + ${java.version} + + + org.apache.maven.plugins maven-resources-plugin