提交 94946018 编写于 作者: Z zhengjie

update LogQueryService

上级 c2155c42
......@@ -39,7 +39,7 @@ public class LogController {
public ResponseEntity getUserLogs(Log log, Pageable pageable){
log.setLogType("INFO");
log.setUsername(SecurityUtils.getUsername());
return new ResponseEntity(logQueryService.queryAll(log,pageable), HttpStatus.OK);
return new ResponseEntity(logQueryService.queryAllByUser(log,pageable), HttpStatus.OK);
}
@GetMapping(value = "/logs/error")
......
......@@ -40,13 +40,15 @@ public class LogQueryService {
public Object queryAll(Log log, Pageable pageable){
Page<Log> page = logRepository.findAll(new Spec(log),pageable);
if (!ObjectUtils.isEmpty(log.getUsername())) {
return PageUtil.toPage(page.map(logSmallMapper::toDto));
}
if (log.getLogType().equals("ERROR")) {
return PageUtil.toPage(page.map(logErrorMapper::toDto));
}
return logRepository.findAll(new Spec(log),pageable);
return page;
}
public Object queryAllByUser(Log log, Pageable pageable) {
Page<Log> page = logRepository.findAll(new Spec(log),pageable);
return PageUtil.toPage(page.map(logSmallMapper::toDto));
}
class Spec implements Specification<Log> {
......
......@@ -89,10 +89,10 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
"/**/*.html",
"/**/*.css",
"/**/*.js"
).permitAll()
).anonymous()
.antMatchers( HttpMethod.POST,"/auth/"+loginPath).permitAll()
.antMatchers("/websocket/**").permitAll()
.antMatchers( HttpMethod.POST,"/auth/"+loginPath).anonymous()
.antMatchers("/websocket/**").anonymous()
// 支付宝回调
.antMatchers("/api/aliPay/return").anonymous()
.antMatchers("/api/aliPay/notify").anonymous()
......@@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers("/test/**").anonymous()
.antMatchers(HttpMethod.OPTIONS, "/**").anonymous()
.antMatchers("/druid/**").permitAll()
.antMatchers("/druid/**").anonymous()
// 所有请求都需要认证
.anyRequest().authenticated()
// 防止iframe 造成跨域
......
......@@ -100,9 +100,6 @@ public class UserController {
@PostMapping(value = "/users")
@PreAuthorize("hasAnyRole('ADMIN','USER_ALL','USER_CREATE')")
public ResponseEntity create(@Validated @RequestBody User resources){
if (resources.getId() != null) {
throw new BadRequestException("A new "+ ENTITY_NAME +" cannot already have an ID");
}
checkLevel(resources);
return new ResponseEntity(userService.create(resources),HttpStatus.CREATED);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册