From aa55ada46db225d22fb0f63eeb1d84a34f45e3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BF=9E=E5=AE=9D=E5=B1=B1?= <1253070437@qq.com> Date: Fri, 19 Jul 2024 03:53:35 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E6=96=87=E4=BB=B6URL=E8=8E=B7=E5=BE=97=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=95=B0=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snowy-admin-web/src/api/dev/fileApi.js | 4 +++ .../file/param/DevFileUrlListParam.java | 36 +++++++++++++++++++ .../modular/file/service/DevFileService.java | 9 +++++ .../file/service/impl/DevFileServiceImpl.java | 12 +++++++ 4 files changed, 61 insertions(+) create mode 100644 snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/param/DevFileUrlListParam.java diff --git a/snowy-admin-web/src/api/dev/fileApi.js b/snowy-admin-web/src/api/dev/fileApi.js index b6c058e6..5c6d8f4c 100644 --- a/snowy-admin-web/src/api/dev/fileApi.js +++ b/snowy-admin-web/src/api/dev/fileApi.js @@ -76,6 +76,10 @@ export default { fileDetail(data) { return request('detail', data, 'get') }, + // 根据文件url集合获取文件集合 + fileGetFileListByUrlList(data) { + return request('getFileListByUrlList', data) + }, // 删除文件 fileDelete(data) { return request('delete', data) diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/param/DevFileUrlListParam.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/param/DevFileUrlListParam.java new file mode 100644 index 00000000..c8fee2fd --- /dev/null +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/param/DevFileUrlListParam.java @@ -0,0 +1,36 @@ +/* + * Copyright [2022] [https://www.xiaonuo.vip] + * + * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: + * + * 1.请不要删除和修改根目录下的LICENSE文件。 + * 2.请不要删除和修改Snowy源码头部的版权声明。 + * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。 + * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip + * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。 + * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip + */ +package vip.xiaonuo.dev.modular.file.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotNull; +import lombok.Getter; +import lombok.Setter; + +import java.util.List; + +/** + * 文件列表参数 + * + * @author yubaoshan + * @date 2024/6/9 23:52 + */ +@Getter +@Setter +public class DevFileUrlListParam { + + /** 文件路径集合 */ + @Schema(description = "文件路径集合") + @NotNull(message = "urlList不能为空") + private List urlList; +} diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/DevFileService.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/DevFileService.java index 274d2635..fe3720fd 100644 --- a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/DevFileService.java +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/DevFileService.java @@ -20,6 +20,7 @@ import vip.xiaonuo.dev.modular.file.entity.DevFile; import vip.xiaonuo.dev.modular.file.param.DevFileIdParam; import vip.xiaonuo.dev.modular.file.param.DevFileListParam; import vip.xiaonuo.dev.modular.file.param.DevFilePageParam; +import vip.xiaonuo.dev.modular.file.param.DevFileUrlListParam; import java.io.IOException; import java.util.List; @@ -88,6 +89,14 @@ public interface DevFileService extends IService { */ DevFile detail(DevFileIdParam devFileIdParam); + /** + * 根据文件url集合获取文件集合 + * + * @author yubaoshan + * @date 2024/6/9 23:52 + **/ + List getFileListByUrlList(DevFileUrlListParam devFileUrlListParam); + /** * 获取文件详情 * diff --git a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/impl/DevFileServiceImpl.java b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/impl/DevFileServiceImpl.java index 64bd6f34..bd5151b0 100644 --- a/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/impl/DevFileServiceImpl.java +++ b/snowy-plugin/snowy-plugin-dev/src/main/java/vip/xiaonuo/dev/modular/file/service/impl/DevFileServiceImpl.java @@ -21,6 +21,7 @@ import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -40,6 +41,7 @@ import vip.xiaonuo.dev.modular.file.mapper.DevFileMapper; import vip.xiaonuo.dev.modular.file.param.DevFileIdParam; import vip.xiaonuo.dev.modular.file.param.DevFileListParam; import vip.xiaonuo.dev.modular.file.param.DevFilePageParam; +import vip.xiaonuo.dev.modular.file.param.DevFileUrlListParam; import vip.xiaonuo.dev.modular.file.service.DevFileService; import vip.xiaonuo.dev.modular.file.util.DevFileAliyunUtil; import vip.xiaonuo.dev.modular.file.util.DevFileLocalUtil; @@ -260,6 +262,16 @@ public class DevFileServiceImpl extends ServiceImpl impl return this.queryEntity(devFileIdParam.getId()); } + @Override + public List getFileListByUrlList(DevFileUrlListParam devFileUrlListParam) { + LambdaQueryWrapper lambdaQueryWrapper = new LambdaQueryWrapper<>(); + // 只查询部分字段 + lambdaQueryWrapper.select(DevFile::getId, DevFile::getSuffix, DevFile::getDownloadPath, DevFile::getName, DevFile::getThumbnail, + DevFile::getSizeKb, DevFile::getSizeInfo, DevFile::getObjName) + .in(DevFile::getDownloadPath, devFileUrlListParam.getUrlList()); + return this.list(lambdaQueryWrapper); + } + @Override public DevFile queryEntity(String id) { DevFile devFile = this.getById(id);