32 lines
1.2 KiB
Java
32 lines
1.2 KiB
Java
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);
|
|
}
|
|
}
|