|
@@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.R;
|
|
|
import com.ruoyi.file.service.FileUploadResponse;
|
|
|
import com.ruoyi.file.service.FilesUpload;
|
|
|
import com.ruoyi.file.service.FilesService;
|
|
|
+import com.usky.common.core.bean.ApiResult;
|
|
|
import com.usky.common.core.bean.CommonPage;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -22,20 +23,20 @@ public class FilesController {
|
|
|
private FilesService filesService;
|
|
|
|
|
|
@PostMapping("/upload")
|
|
|
- public R<FileUploadResponse> upload(@RequestParam MultipartFile file) {
|
|
|
+ public ApiResult<FileUploadResponse> upload(@RequestParam MultipartFile file) {
|
|
|
// 获取上传文件
|
|
|
FileUploadResponse response = filesService.upload(file);
|
|
|
- return R.ok(response);
|
|
|
+ return ApiResult.success(response);
|
|
|
}
|
|
|
|
|
|
|
|
|
@DeleteMapping("/delete/{id}")
|
|
|
- public R<Void> delete(@PathVariable Integer id) {
|
|
|
+ public ApiResult<String> delete(@PathVariable Integer id) {
|
|
|
try {
|
|
|
filesService.deleteFile(id);
|
|
|
- return R.ok();
|
|
|
+ return ApiResult.success("删除成功");
|
|
|
} catch (Exception e) {
|
|
|
- return R.fail(e.getMessage()); // 删除失败,返回错误信息
|
|
|
+ return ApiResult.error("删除失败"); // 删除失败,返回错误信息
|
|
|
}
|
|
|
}
|
|
|
|