Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Eladmin
Commits
94946018
Commit
94946018
authored
May 29, 2019
by
zhengjie
Browse files
update LogQueryService
parent
c2155c42
Changes
4
Hide whitespace changes
Inline
Side-by-side
eladmin-logging/src/main/java/me/zhengjie/rest/LogController.java
View file @
94946018
...
...
@@ -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
.
queryAll
ByUser
(
log
,
pageable
),
HttpStatus
.
OK
);
}
@GetMapping
(
value
=
"/logs/error"
)
...
...
eladmin-logging/src/main/java/me/zhengjie/service/query/LogQueryService.java
View file @
94946018
...
...
@@ -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
>
{
...
...
eladmin-system/src/main/java/me/zhengjie/modules/security/config/SecurityConfig.java
View file @
94946018
...
...
@@ -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 造成跨域
...
...
eladmin-system/src/main/java/me/zhengjie/modules/system/rest/UserController.java
View file @
94946018
...
...
@@ -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
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment