【新增】增加通过文件id查询文件详情接口

pull/229/MERGE
初衷 3 months ago
parent 93111a8490
commit 655779b289

@ -12,6 +12,7 @@
*/ */
package vip.xiaonuo.dev.api; package vip.xiaonuo.dev.api;
import cn.hutool.json.JSONObject;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
/** /**
@ -101,4 +102,12 @@ public interface DevFileApi {
* @date 2022/6/22 17:44 * @date 2022/6/22 17:44
**/ **/
String storageFileWithReturnIdMinio(MultipartFile file); 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; package vip.xiaonuo.dev.modular.file.provider;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; 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.enums.DevFileEngineTypeEnum;
import vip.xiaonuo.dev.modular.file.service.DevFileService; import vip.xiaonuo.dev.modular.file.service.DevFileService;
import java.util.Optional;
/** /**
* API * API
* *
@ -70,4 +74,11 @@ public class DevFileApiProvider implements DevFileApi {
public String storageFileWithReturnIdMinio(MultipartFile file) { public String storageFileWithReturnIdMinio(MultipartFile file) {
return devFileService.uploadReturnId(DevFileEngineTypeEnum.MINIO.getValue(), 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…
Cancel
Save