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);
|
}
|
|
}
|