feat: 增加附件表结构与本地上传接口
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.bruce.common.controller;
|
||||
|
||||
import com.bruce.common.entity.SysAttachment;
|
||||
import com.bruce.common.service.ISysAttachmentService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Tag(name = "系统附件管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/attachments")
|
||||
public class SysAttachmentController {
|
||||
|
||||
private final ISysAttachmentService sysAttachmentService;
|
||||
|
||||
public SysAttachmentController(ISysAttachmentService sysAttachmentService) {
|
||||
this.sysAttachmentService = sysAttachmentService;
|
||||
}
|
||||
|
||||
@Operation(summary = "上传附件")
|
||||
@PostMapping("/upload")
|
||||
public SysAttachment upload(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam String sourceType,
|
||||
@RequestParam(required = false) Long sourceId) {
|
||||
return sysAttachmentService.upload(file, sourceType, sourceId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user