55 lines
1.6 KiB
Java
55 lines
1.6 KiB
Java
package net.maku.system.controller;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import lombok.AllArgsConstructor;
|
|
import net.maku.framework.common.page.PageResult;
|
|
import net.maku.framework.common.utils.Result;
|
|
import net.maku.system.query.SysAttachmentQuery;
|
|
import net.maku.system.service.SysAttachmentService;
|
|
import net.maku.system.vo.SysAttachmentVO;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.validation.Valid;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 附件管理
|
|
*
|
|
* @author 阿沐 babamu@126.com
|
|
*/
|
|
@RestController
|
|
@RequestMapping("sys/attachment")
|
|
@Tag(name = "附件管理")
|
|
@AllArgsConstructor
|
|
public class SysAttachmentController {
|
|
private final SysAttachmentService sysAttachmentService;
|
|
|
|
@GetMapping("page")
|
|
@Operation(summary = "分页")
|
|
@PreAuthorize("hasAuthority('sys:attachment:page')")
|
|
public Result<PageResult<SysAttachmentVO>> page(@Valid SysAttachmentQuery query) {
|
|
PageResult<SysAttachmentVO> page = sysAttachmentService.page(query);
|
|
|
|
return Result.ok(page);
|
|
}
|
|
|
|
@PostMapping
|
|
@Operation(summary = "保存")
|
|
@PreAuthorize("hasAuthority('sys:attachment:save')")
|
|
public Result<String> save(@RequestBody SysAttachmentVO vo) {
|
|
sysAttachmentService.save(vo);
|
|
|
|
return Result.ok();
|
|
}
|
|
|
|
@DeleteMapping
|
|
@Operation(summary = "删除")
|
|
@PreAuthorize("hasAuthority('sys:attachment:delete')")
|
|
public Result<String> delete(@RequestBody List<Long> idList) {
|
|
sysAttachmentService.delete(idList);
|
|
|
|
return Result.ok();
|
|
}
|
|
} |