mirror of https://gitee.com/xiaonuobase/snowy
【新增】增加通过文件id查询文件详情接口
parent
93111a8490
commit
655779b289
|
@ -12,6 +12,7 @@
|
|||
*/
|
||||
package vip.xiaonuo.dev.api;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
|
@ -101,4 +102,12 @@ public interface DevFileApi {
|
|||
* @date 2022/6/22 17:44
|
||||
**/
|
||||
String storageFileWithReturnIdMinio(MultipartFile file);
|
||||
|
||||
/**
|
||||
* 通过文件id查询文件详情
|
||||
*
|
||||
* @author chengchuanyao
|
||||
* @date 2024/7/26 16:10
|
||||
*/
|
||||
JSONObject getFileInfoById(String id);
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
*/
|
||||
package vip.xiaonuo.dev.modular.file.provider;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
@ -19,6 +21,8 @@ import vip.xiaonuo.dev.api.DevFileApi;
|
|||
import vip.xiaonuo.dev.modular.file.enums.DevFileEngineTypeEnum;
|
||||
import vip.xiaonuo.dev.modular.file.service.DevFileService;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 文件API接口提供者
|
||||
*
|
||||
|
@ -70,4 +74,11 @@ public class DevFileApiProvider implements DevFileApi {
|
|||
public String storageFileWithReturnIdMinio(MultipartFile file) {
|
||||
return devFileService.uploadReturnId(DevFileEngineTypeEnum.MINIO.getValue(), file);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getFileInfoById(String id) {
|
||||
return Optional.ofNullable(devFileService.getById(id))
|
||||
.map(JSONUtil::parseObj)
|
||||
.orElse(new JSONObject());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue