mirror of
				https://github.com/continew-org/continew-admin.git
				synced 2025-10-31 22:57:17 +08:00 
			
		
		
		
	feat: 文件管理适配详情、下载,音视频、图片文件允许在线打开
This commit is contained in:
		| @@ -1,93 +0,0 @@ | ||||
| /* | ||||
|  * Copyright (c) 2022-present Charles7c Authors. All Rights Reserved. | ||||
|  * | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  * | ||||
|  *     http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  */ | ||||
|  | ||||
| package top.charles7c.continew.admin.system.model.resp; | ||||
|  | ||||
| import java.io.Serial; | ||||
|  | ||||
| import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||
| import com.alibaba.excel.annotation.ExcelProperty; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.enums.FileTypeEnum; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseDetailResp; | ||||
|  | ||||
| /** | ||||
|  * 文件详情信息 | ||||
|  * | ||||
|  * @author Charles7c | ||||
|  * @since 2023/12/23 10:38 | ||||
|  */ | ||||
| @Data | ||||
| @ExcelIgnoreUnannotated | ||||
| @Schema(description = "文件详情信息") | ||||
| public class FileDetailResp extends BaseDetailResp { | ||||
|  | ||||
|     @Serial | ||||
|     private static final long serialVersionUID = 1L; | ||||
|  | ||||
|     /** | ||||
|      * 名称 | ||||
|      */ | ||||
|     @Schema(description = "名称") | ||||
|     @ExcelProperty(value = "名称") | ||||
|     private String name; | ||||
|  | ||||
|     /** | ||||
|      * 大小(字节) | ||||
|      */ | ||||
|     @Schema(description = "大小(字节)") | ||||
|     @ExcelProperty(value = "大小(字节)") | ||||
|     private Long size; | ||||
|  | ||||
|     /** | ||||
|      * URL | ||||
|      */ | ||||
|     @Schema(description = "URL") | ||||
|     @ExcelProperty(value = "URL") | ||||
|     private String url; | ||||
|  | ||||
|     /** | ||||
|      * 扩展名 | ||||
|      */ | ||||
|     @Schema(description = "扩展名") | ||||
|     @ExcelProperty(value = "扩展名") | ||||
|     private String extension; | ||||
|  | ||||
|     /** | ||||
|      * MIME类型 | ||||
|      */ | ||||
|     @Schema(description = "MIME类型") | ||||
|     @ExcelProperty(value = "MIME类型") | ||||
|     private String mimeType; | ||||
|  | ||||
|     /** | ||||
|      * 类型 | ||||
|      */ | ||||
|     @Schema(description = "类型") | ||||
|     @ExcelProperty(value = "类型") | ||||
|     private FileTypeEnum type; | ||||
|  | ||||
|     /** | ||||
|      * 存储库ID | ||||
|      */ | ||||
|     @Schema(description = "存储库ID") | ||||
|     @ExcelProperty(value = "存储库ID") | ||||
|     private Long storageId; | ||||
| } | ||||
| @@ -17,14 +17,16 @@ | ||||
| package top.charles7c.continew.admin.system.model.resp; | ||||
|  | ||||
| import java.io.Serial; | ||||
| import java.time.LocalDateTime; | ||||
|  | ||||
| import lombok.Data; | ||||
|  | ||||
| import io.swagger.v3.oas.annotations.media.Schema; | ||||
|  | ||||
| import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | ||||
| import com.alibaba.excel.annotation.ExcelProperty; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.enums.FileTypeEnum; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseResp; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseDetailResp; | ||||
|  | ||||
| /** | ||||
|  * 文件信息 | ||||
| @@ -33,8 +35,9 @@ import top.charles7c.continew.starter.extension.crud.base.BaseResp; | ||||
|  * @since 2023/12/23 10:38 | ||||
|  */ | ||||
| @Data | ||||
| @Schema(description = "文件信息") | ||||
| public class FileResp extends BaseResp { | ||||
| @ExcelIgnoreUnannotated | ||||
| @Schema(description = "文件详情信息") | ||||
| public class FileResp extends BaseDetailResp { | ||||
|  | ||||
|     @Serial | ||||
|     private static final long serialVersionUID = 1L; | ||||
| @@ -42,48 +45,49 @@ public class FileResp extends BaseResp { | ||||
|     /** | ||||
|      * 名称 | ||||
|      */ | ||||
|     @Schema(description = "名称") | ||||
|     @Schema(description = "名称", example = "example") | ||||
|     @ExcelProperty(value = "名称") | ||||
|     private String name; | ||||
|  | ||||
|     /** | ||||
|      * 大小(字节) | ||||
|      */ | ||||
|     @Schema(description = "大小(字节)") | ||||
|     @Schema(description = "大小(字节)", example = "4096") | ||||
|     @ExcelProperty(value = "大小(字节)") | ||||
|     private Long size; | ||||
|  | ||||
|     /** | ||||
|      * URL | ||||
|      */ | ||||
|     @Schema(description = "URL") | ||||
|     @Schema(description = "URL", example = "https://examplebucket.oss-cn-hangzhou.aliyuncs.com/example/example.jpg") | ||||
|     @ExcelProperty(value = "URL") | ||||
|     private String url; | ||||
|  | ||||
|     /** | ||||
|      * 扩展名 | ||||
|      */ | ||||
|     @Schema(description = "扩展名") | ||||
|     @Schema(description = "扩展名", example = "jpg") | ||||
|     @ExcelProperty(value = "扩展名") | ||||
|     private String extension; | ||||
|  | ||||
|     /** | ||||
|      * MIME类型 | ||||
|      */ | ||||
|     @Schema(description = "MIME类型") | ||||
|     @ExcelProperty(value = "MIME类型") | ||||
|     private String mimeType; | ||||
|  | ||||
|     /** | ||||
|      * 类型 | ||||
|      */ | ||||
|     @Schema(description = "类型") | ||||
|     @Schema(description = "类型", type = "Integer", allowableValues = {"1", "2", "3", "4", "5"}, example = "2") | ||||
|     @ExcelProperty(value = "类型") | ||||
|     private FileTypeEnum type; | ||||
|  | ||||
|     /** | ||||
|      * 存储库ID | ||||
|      * 存储库 ID | ||||
|      */ | ||||
|     @Schema(description = "存储库ID") | ||||
|     @Schema(description = "存储库ID", example = "1") | ||||
|     @ExcelProperty(value = "存储库ID") | ||||
|     private Long storageId; | ||||
|  | ||||
|     /** | ||||
|      * 修改时间 | ||||
|      */ | ||||
|     @Schema(description = "修改时间") | ||||
|     private LocalDateTime updateTime; | ||||
| } | ||||
| @@ -23,7 +23,6 @@ import org.springframework.web.multipart.MultipartFile; | ||||
|  | ||||
| import top.charles7c.continew.admin.system.model.query.FileQuery; | ||||
| import top.charles7c.continew.admin.system.model.req.FileReq; | ||||
| import top.charles7c.continew.admin.system.model.resp.FileDetailResp; | ||||
| import top.charles7c.continew.admin.system.model.resp.FileResp; | ||||
| import top.charles7c.continew.starter.extension.crud.base.BaseService; | ||||
|  | ||||
| @@ -33,7 +32,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseService; | ||||
|  * @author Charles7c | ||||
|  * @since 2023/12/23 10:38 | ||||
|  */ | ||||
| public interface FileService extends BaseService<FileResp, FileDetailResp, FileQuery, FileReq> { | ||||
| public interface FileService extends BaseService<FileResp, FileResp, FileQuery, FileReq> { | ||||
|  | ||||
|     /** | ||||
|      * 上传到默认存储库 | ||||
|   | ||||
| @@ -38,7 +38,6 @@ import top.charles7c.continew.admin.system.model.entity.FileDO; | ||||
| import top.charles7c.continew.admin.system.model.entity.StorageDO; | ||||
| import top.charles7c.continew.admin.system.model.query.FileQuery; | ||||
| import top.charles7c.continew.admin.system.model.req.FileReq; | ||||
| import top.charles7c.continew.admin.system.model.resp.FileDetailResp; | ||||
| import top.charles7c.continew.admin.system.model.resp.FileResp; | ||||
| import top.charles7c.continew.admin.system.model.resp.StorageDetailResp; | ||||
| import top.charles7c.continew.admin.system.service.FileService; | ||||
| @@ -57,7 +56,7 @@ import top.charles7c.continew.starter.extension.crud.base.BaseServiceImpl; | ||||
| @Slf4j | ||||
| @Service | ||||
| @RequiredArgsConstructor | ||||
| public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileResp, FileDetailResp, FileQuery, FileReq> | ||||
| public class FileServiceImpl extends BaseServiceImpl<FileMapper, FileDO, FileResp, FileResp, FileQuery, FileReq> | ||||
|     implements FileService { | ||||
|  | ||||
|     @Resource | ||||
|   | ||||
		Reference in New Issue
	
	Block a user