Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-usercenter
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit f39ff14d
authored
Jul 18, 2023
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.22.0 实现特殊登陆标记功能
1 parent
eec0aa22
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
3 deletions
src/main/java/cn/com/glsx/shield/modules/LoginController.java
src/main/java/cn/com/glsx/shield/modules/mapper/UserMapper.java
src/main/java/cn/com/glsx/shield/modules/service/UserService.java
src/main/resources/mapper/UserMapper.xml
src/main/java/cn/com/glsx/shield/modules/LoginController.java
View file @
f39ff14
...
...
@@ -115,6 +115,8 @@ public class LoginController {
UserDTO
userInfo
=
userService
.
userInfo
(
user
.
getId
());
rtnMap
.
put
(
"user"
,
userInfo
);
// 登录校验成功以后 保存UID
userService
.
saveUID
(
user
,
loginBO
);
return
R
.
ok
().
data
(
rtnMap
);
}
...
...
src/main/java/cn/com/glsx/shield/modules/mapper/UserMapper.java
View file @
f39ff14
...
...
@@ -69,5 +69,7 @@ public interface UserMapper extends CommonBaseMapper<User> {
List
<
CUser
>
selectByRelUserIds
(
@Param
(
"relUserIds"
)
Collection
<
Long
>
relUserIds
);
Integer
saveUIDById
(
@Param
(
"id"
)
Long
id
,
@Param
(
"specialMark"
)
String
specialMark
);
Integer
resetUIDById
(
@Param
(
"id"
)
Long
id
);
}
\ No newline at end of file
src/main/java/cn/com/glsx/shield/modules/service/UserService.java
View file @
f39ff14
...
...
@@ -9,6 +9,7 @@ import cn.com.glsx.shield.common.exception.UserCenterException;
import
cn.com.glsx.shield.modules.converter.*
;
import
cn.com.glsx.shield.modules.entity.*
;
import
cn.com.glsx.shield.modules.mapper.*
;
import
cn.com.glsx.shield.modules.model.LoginBO
;
import
cn.com.glsx.shield.modules.model.export.UserExport
;
import
cn.com.glsx.shield.modules.model.param.ChangePasswordBO
;
import
cn.com.glsx.shield.modules.model.param.UserBO
;
...
...
@@ -1108,12 +1109,30 @@ public class UserService {
}
/**
* 保存UID 对于特殊登陆且数据库没有设置UID的 将前端传过来的UID保存起来
*
* @param user 用户数据
* @param loginBO 前端传过来的登陆数据
*/
public
void
saveUID
(
User
user
,
LoginBO
loginBO
)
{
if
(!
Objects
.
equals
(
SpecialLoginEnum
.
SPECIAL_LOGIN
.
getCode
(),
user
.
getSpecialLogin
()))
{
log
.
info
(
user
.
getAccount
()
+
"不是特殊登录的账号"
);
return
;
}
if
(
Objects
.
isNull
(
user
.
getSpecialLogin
())
&&
Objects
.
nonNull
(
loginBO
.
getSpecialMark
()))
{
Integer
num
=
userMapper
.
saveUIDById
(
user
.
getId
(),
loginBO
.
getSpecialMark
());
log
.
info
(
user
.
getId
()
+
":saveUID:"
+
num
);
}
}
/**
* 根据用户ID重置UID 将UID设置为空
*
* @param id 用户ID
*/
public
void
resetUID
(
Long
id
)
{
Integer
num
=
userMapper
.
resetUIDById
(
id
);
log
.
info
(
"
resetUID:"
+
num
);
log
.
info
(
id
+
":
resetUID:"
+
num
);
}
}
src/main/resources/mapper/UserMapper.xml
View file @
f39ff14
...
...
@@ -358,9 +358,15 @@
</foreach>
</select>
<select
id=
"resetUIDById"
resultType=
"java.lang.Integer"
>
<update
id=
"saveUIDById"
>
update t_user
set special_mark = #{specialMark}
where id = #{id}
</update>
<update
id=
"resetUIDById"
>
update t_user
set special_mark = null
where id = #{id}
</
select
>
</
update
>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment