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
wwwanlingxiao
mall
Commits
f61c8a50
Commit
f61c8a50
authored
Apr 18, 2023
by
macro
Browse files
Update UmsAdminServiceImpl.java
parent
f7fcf077
Changes
1
Hide whitespace changes
Inline
Side-by-side
mall-admin/src/main/java/com/macro/mall/service/impl/UmsAdminServiceImpl.java
View file @
f61c8a50
...
...
@@ -60,13 +60,16 @@ public class UmsAdminServiceImpl implements UmsAdminService {
@Override
public
UmsAdmin
getAdminByUsername
(
String
username
)
{
//先从缓存中获取数据
UmsAdmin
admin
=
getCacheService
().
getAdmin
(
username
);
if
(
admin
!=
null
)
return
admin
;
if
(
admin
!=
null
)
return
admin
;
//缓存中没有从数据库中获取
UmsAdminExample
example
=
new
UmsAdminExample
();
example
.
createCriteria
().
andUsernameEqualTo
(
username
);
List
<
UmsAdmin
>
adminList
=
adminMapper
.
selectByExample
(
example
);
if
(
adminList
!=
null
&&
adminList
.
size
()
>
0
)
{
admin
=
adminList
.
get
(
0
);
//将数据库中的数据存入缓存中
getCacheService
().
setAdmin
(
admin
);
return
admin
;
}
...
...
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