satoken - 1
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.nl.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -27,7 +28,6 @@ import org.nl.utils.FileUtil;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -49,21 +49,21 @@ public class LocalStorageController {
|
||||
|
||||
@ApiOperation("查询文件")
|
||||
@GetMapping
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
@SaCheckPermission("storage:list")
|
||||
public ResponseEntity<Object> query(LocalStorageQueryCriteria criteria, Pageable pageable) {
|
||||
return new ResponseEntity<>(localStorageService.queryAll(criteria, pageable), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ApiOperation("导出数据")
|
||||
@GetMapping(value = "/download")
|
||||
@PreAuthorize("@el.check('storage:list')")
|
||||
@SaCheckPermission("storage:list")
|
||||
public void download(HttpServletResponse response, LocalStorageQueryCriteria criteria) throws IOException {
|
||||
localStorageService.download(localStorageService.queryAll(criteria), response);
|
||||
}
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
@PostMapping
|
||||
@PreAuthorize("@el.check('storage:add')")
|
||||
@SaCheckPermission("storage:add")
|
||||
public ResponseEntity<Object> create(@RequestParam String name, @RequestParam("file") MultipartFile file) {
|
||||
LocalStorage localStorage = localStorageService.create(name, file);
|
||||
return new ResponseEntity<>(localStorage, HttpStatus.CREATED);
|
||||
@@ -84,7 +84,7 @@ public class LocalStorageController {
|
||||
@Log("修改文件")
|
||||
@ApiOperation("修改文件")
|
||||
@PutMapping
|
||||
@PreAuthorize("@el.check('storage:edit')")
|
||||
@SaCheckPermission("storage:edit")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody LocalStorage resources) {
|
||||
localStorageService.update(resources);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
|
||||
Reference in New Issue
Block a user