liyong
4 天以前 d62a74c14a4002c0f401c94976fba8cc77cda6e1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package cn.iocoder.yudao.module.system.controller.admin.storage;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.system.controller.admin.storage.vo.SystemStorageAttachmentListReqVO;
import cn.iocoder.yudao.module.system.controller.admin.storage.vo.SystemStorageAttachmentSaveReqVO;
import cn.iocoder.yudao.module.system.controller.admin.storage.vo.SystemStorageBlobRespVO;
import cn.iocoder.yudao.module.system.service.storage.SystemStorageAttachmentService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
 
import java.util.List;
 
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 
/**
 * 管理后台 - 文件附件关联
 *
 * @author 芋道源码
 */
@Tag(name = "管理后台 - 文件附件关联")
@RestController
@RequestMapping("/system/storage-attachment")
@Validated
public class SystemStorageAttachmentController {
 
    @Resource
    private SystemStorageAttachmentService storageAttachmentService;
 
    @GetMapping("/list")
    @Operation(summary = "查询附件列表")
    @PreAuthorize("@ss.hasPermission('system:storage-attachment:query')")
    public CommonResult<List<SystemStorageBlobRespVO>> listAttachments(
            @Valid SystemStorageAttachmentListReqVO reqVO) {
        return success(storageAttachmentService.listAttachments(reqVO));
    }
 
    @PostMapping("/bind")
    @Operation(summary = "绑定附件到业务记录")
    @PreAuthorize("@ss.hasPermission('system:storage-attachment:create')")
    public CommonResult<Boolean> bindAttachments(
            @Valid @RequestBody SystemStorageAttachmentSaveReqVO reqVO) {
        storageAttachmentService.bindAttachments(reqVO);
        return success(true);
    }
 
    @DeleteMapping("/delete")
    @Operation(summary = "批量删除附件")
    @PreAuthorize("@ss.hasPermission('system:storage-attachment:delete')")
    public CommonResult<Boolean> deleteAttachments(@RequestBody List<Long> ids) {
        storageAttachmentService.deleteAttachments(ids);
        return success(true);
    }
 
}