Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
chnmuseum-party
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liqin
chnmuseum-party
Commits
38993a44
Commit
38993a44
authored
Apr 07, 2021
by
liqin
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
6f4b0b70
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
MetaObjectHandlerConfig.java
...nmuseum/party/common/mybatis/MetaObjectHandlerConfig.java
+9
-7
No files found.
src/main/java/cn/wisenergy/chnmuseum/party/common/mybatis/MetaObjectHandlerConfig.java
View file @
38993a44
...
...
@@ -3,6 +3,8 @@ package cn.wisenergy.chnmuseum.party.common.mybatis;
import
cn.wisenergy.chnmuseum.party.model.TUser
;
import
com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
;
import
org.apache.ibatis.reflection.MetaObject
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.subject.Subject
;
import
org.springframework.stereotype.Component
;
import
java.time.LocalDateTime
;
...
...
@@ -28,9 +30,9 @@ public class MetaObjectHandlerConfig implements MetaObjectHandler {
}
final
TUser
currentUser
=
getCurrentUser
();
if
(
currentUser
!=
null
)
{
this
.
setFieldValByName
(
"userId"
,
currentUser
.
getId
(),
metaObject
);
this
.
setFieldValByName
(
"userName"
,
currentUser
.
getUserName
(),
metaObject
);
this
.
setFieldValByName
(
"orgName"
,
currentUser
.
getOrgName
(),
metaObject
);
//
this.setFieldValByName("userId", currentUser.getId(), metaObject);
//
this.setFieldValByName("userName", currentUser.getUserName(), metaObject);
//
this.setFieldValByName("orgName", currentUser.getOrgName(), metaObject);
}
}
...
...
@@ -49,10 +51,10 @@ public class MetaObjectHandlerConfig implements MetaObjectHandler {
* @return 用户对象
*/
private
TUser
getCurrentUser
()
{
//
Subject subject = SecurityUtils.getSubject();
//
if (subject != null) {
//
return (TUser) subject.getPrincipal();
//
}
Subject
subject
=
SecurityUtils
.
getSubject
();
if
(
subject
!=
null
)
{
return
(
TUser
)
subject
.
getPrincipal
();
}
return
null
;
}
...
...
Write
Preview
Markdown
is supported
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