2022-08-24 00:10:59 +08:00
|
|
|
package net.maku.system.controller;
|
|
|
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
2023-01-18 00:04:56 +08:00
|
|
|
import jakarta.validation.Valid;
|
2022-08-24 00:10:59 +08:00
|
|
|
import lombok.AllArgsConstructor;
|
2023-01-20 13:47:45 +08:00
|
|
|
import net.maku.framework.common.utils.PageResult;
|
2022-08-24 00:10:59 +08:00
|
|
|
import net.maku.framework.common.utils.Result;
|
2023-05-22 15:59:15 +08:00
|
|
|
import net.maku.framework.operatelog.annotations.OperateLog;
|
|
|
|
import net.maku.framework.operatelog.enums.OperateTypeEnum;
|
2022-08-24 00:10:59 +08:00
|
|
|
import net.maku.system.query.SysAttachmentQuery;
|
|
|
|
import net.maku.system.service.SysAttachmentService;
|
|
|
|
import net.maku.system.vo.SysAttachmentVO;
|
2023-01-18 00:04:56 +08:00
|
|
|
import org.springdoc.core.annotations.ParameterObject;
|
2022-08-24 00:10:59 +08:00
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 附件管理
|
|
|
|
*
|
|
|
|
* @author 阿沐 babamu@126.com
|
2023-02-21 16:44:04 +08:00
|
|
|
* <a href="https://maku.net">MAKU</a>
|
2022-08-24 00:10:59 +08:00
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("sys/attachment")
|
|
|
|
@Tag(name = "附件管理")
|
|
|
|
@AllArgsConstructor
|
|
|
|
public class SysAttachmentController {
|
|
|
|
private final SysAttachmentService sysAttachmentService;
|
|
|
|
|
|
|
|
@GetMapping("page")
|
|
|
|
@Operation(summary = "分页")
|
|
|
|
@PreAuthorize("hasAuthority('sys:attachment:page')")
|
2023-01-15 20:08:11 +08:00
|
|
|
public Result<PageResult<SysAttachmentVO>> page(@ParameterObject @Valid SysAttachmentQuery query) {
|
2022-08-24 00:10:59 +08:00
|
|
|
PageResult<SysAttachmentVO> page = sysAttachmentService.page(query);
|
|
|
|
|
|
|
|
return Result.ok(page);
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping
|
|
|
|
@Operation(summary = "保存")
|
2023-05-22 15:59:15 +08:00
|
|
|
@OperateLog(type = OperateTypeEnum.INSERT)
|
2022-08-24 00:10:59 +08:00
|
|
|
@PreAuthorize("hasAuthority('sys:attachment:save')")
|
|
|
|
public Result<String> save(@RequestBody SysAttachmentVO vo) {
|
|
|
|
sysAttachmentService.save(vo);
|
|
|
|
|
|
|
|
return Result.ok();
|
|
|
|
}
|
|
|
|
|
|
|
|
@DeleteMapping
|
|
|
|
@Operation(summary = "删除")
|
2023-05-22 15:59:15 +08:00
|
|
|
@OperateLog(type = OperateTypeEnum.DELETE)
|
2022-08-24 00:10:59 +08:00
|
|
|
@PreAuthorize("hasAuthority('sys:attachment:delete')")
|
|
|
|
public Result<String> delete(@RequestBody List<Long> idList) {
|
|
|
|
sysAttachmentService.delete(idList);
|
|
|
|
|
|
|
|
return Result.ok();
|
|
|
|
}
|
|
|
|
}
|