satoken - 1

This commit is contained in:
2022-09-21 10:15:52 +08:00
parent a1679eec50
commit d02f83da25
63 changed files with 663 additions and 1246 deletions

View File

@@ -21,14 +21,10 @@ import lombok.RequiredArgsConstructor;
import org.nl.annotation.Log;
import org.nl.service.LogService;
import org.nl.service.dto.LogQueryCriteria;
import org.nl.utils.SecurityUtils;
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.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* @author Zheng Jie
@@ -43,7 +39,7 @@ public class LogController {
private final LogService logService;
@GetMapping
@ApiOperation("日志查询")
//@PreAuthorize("@el.check()")
//@SaCheckPermission("@el.check()")
public ResponseEntity<Object> query(LogQueryCriteria criteria, Pageable pageable){
criteria.setLogType("INFO");
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
@@ -53,13 +49,14 @@ public class LogController {
// @ApiOperation("用户日志查询")
public ResponseEntity<Object> queryUserLog(LogQueryCriteria criteria, Pageable pageable){
criteria.setLogType("INFO");
criteria.setBlurry(SecurityUtils.getCurrentUsername());
// criteria.setBlurry(SecurityUtils.getCurrentUsername());
criteria.setBlurry("");
return new ResponseEntity<>(logService.queryAllByUser(criteria,pageable), HttpStatus.OK);
}
@GetMapping(value = "/error")
@ApiOperation("错误日志查询")
// @PreAuthorize("@el.check()")
// @SaCheckPermission("@el.check()")
public ResponseEntity<Object> queryErrorLog(LogQueryCriteria criteria, Pageable pageable){
criteria.setLogType("ERROR");
return new ResponseEntity<>(logService.queryAll(criteria,pageable), HttpStatus.OK);
@@ -67,14 +64,14 @@ public class LogController {
@GetMapping(value = "/error/{id}")
@ApiOperation("日志异常详情查询")
// @PreAuthorize("@el.check()")
// @SaCheckPermission("@el.check()")
public ResponseEntity<Object> queryErrorLogs(@PathVariable Long id){
return new ResponseEntity<>(logService.findByErrDetail(id), HttpStatus.OK);
}
@DeleteMapping(value = "/del/error")
@Log("删除所有ERROR日志")
@ApiOperation("删除所有ERROR日志")
// @PreAuthorize("@el.check()")
// @SaCheckPermission("@el.check()")
public ResponseEntity<Object> delAllErrorLog(){
logService.delAllByError();
return new ResponseEntity<>(HttpStatus.OK);
@@ -83,7 +80,7 @@ public class LogController {
@DeleteMapping(value = "/del/info")
@Log("删除所有INFO日志")
@ApiOperation("删除所有INFO日志")
// @PreAuthorize("@el.check()")
// @SaCheckPermission("@el.check()")
public ResponseEntity<Object> delAllInfoLog(){
logService.delAllByInfo();
return new ResponseEntity<>(HttpStatus.OK);