Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-miniappserver
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 e0cf398e
authored
Jul 08, 2022
by
levphon
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
用户账号处理
1 parent
6b3431c8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
1 deletions
src/main/java/cn/com/glsx/app/modules/mapper/UserLocalAccountMapper.java
src/main/java/cn/com/glsx/app/modules/service/UserService.java
src/main/resources/mapper/UserLocalAccountMapper.xml
src/main/java/cn/com/glsx/app/modules/mapper/UserLocalAccountMapper.java
View file @
e0cf398
...
@@ -3,10 +3,14 @@ package cn.com.glsx.app.modules.mapper;
...
@@ -3,10 +3,14 @@ package cn.com.glsx.app.modules.mapper;
import
cn.com.glsx.app.modules.entity.UserLocalAccount
;
import
cn.com.glsx.app.modules.entity.UserLocalAccount
;
import
cn.com.glsx.app.modules.model.AppUser
;
import
cn.com.glsx.app.modules.model.AppUser
;
import
cn.com.glsx.app.modules.model.CTerminalUserModel
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
com.glsx.plat.mybatis.mapper.CommonBaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.Collection
;
import
java.util.List
;
@Mapper
@Mapper
public
interface
UserLocalAccountMapper
extends
CommonBaseMapper
<
UserLocalAccount
>
{
public
interface
UserLocalAccountMapper
extends
CommonBaseMapper
<
UserLocalAccount
>
{
...
@@ -16,4 +20,6 @@ public interface UserLocalAccountMapper extends CommonBaseMapper<UserLocalAccoun
...
@@ -16,4 +20,6 @@ public interface UserLocalAccountMapper extends CommonBaseMapper<UserLocalAccoun
AppUser
selectRelUserByUserId
(
@Param
(
"userId"
)
Long
userId
);
AppUser
selectRelUserByUserId
(
@Param
(
"userId"
)
Long
userId
);
List
<
CTerminalUserModel
>
selectByUserIds
(
@Param
(
"userIds"
)
Collection
<
Long
>
userIds
);
}
}
\ No newline at end of file
\ No newline at end of file
src/main/java/cn/com/glsx/app/modules/service/UserService.java
View file @
e0cf398
...
@@ -13,6 +13,8 @@ import cn.hutool.core.lang.UUID;
...
@@ -13,6 +13,8 @@ import cn.hutool.core.lang.UUID;
import
com.glsx.plat.common.utils.ObjectUtils
;
import
com.glsx.plat.common.utils.ObjectUtils
;
import
com.glsx.plat.jwt.base.ComJwtUser
;
import
com.glsx.plat.jwt.base.ComJwtUser
;
import
com.glsx.plat.jwt.util.JwtUtils
;
import
com.glsx.plat.jwt.util.JwtUtils
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.Assert
;
import
org.springframework.util.Assert
;
...
@@ -88,12 +90,40 @@ public class UserService {
...
@@ -88,12 +90,40 @@ public class UserService {
}
}
}
}
/**
* 获取本地账号
*
* @param userIds
* @return
*/
public
List
<
CTerminalUserModel
>
getLocalUsers
(
Collection
<
Long
>
userIds
)
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
Lists
.
newArrayList
();
}
return
userLocalAccountMapper
.
selectByUserIds
(
userIds
);
}
public
Map
<
Long
,
CTerminalUserModel
>
getLocalUserMap
(
Collection
<
Long
>
userIds
)
{
List
<
CTerminalUserModel
>
userModelList
=
this
.
getLocalUsers
(
userIds
);
return
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
CTerminalUserModel:
:
getUserId
,
Function
.
identity
()));
}
/**
* 获取微信账号
*
* @param userIds
* @return
*/
public
List
<
CTerminalUserModel
>
getWechatUsers
(
Collection
<
Long
>
userIds
)
{
public
List
<
CTerminalUserModel
>
getWechatUsers
(
Collection
<
Long
>
userIds
)
{
if
(
CollectionUtils
.
isEmpty
(
userIds
))
{
return
Lists
.
newArrayList
();
}
return
userWechatAccountMapper
.
selectByUserIds
(
userIds
);
return
userWechatAccountMapper
.
selectByUserIds
(
userIds
);
}
}
public
Map
<
Long
,
CTerminalUserModel
>
getWechatUserMap
(
Collection
<
Long
>
userIds
)
{
public
Map
<
Long
,
CTerminalUserModel
>
getWechatUserMap
(
Collection
<
Long
>
userIds
)
{
List
<
CTerminalUserModel
>
userModelList
=
userWechatAccountMapper
.
selectByUserId
s
(
userIds
);
List
<
CTerminalUserModel
>
userModelList
=
this
.
getWechatUser
s
(
userIds
);
return
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
CTerminalUserModel:
:
getUserId
,
Function
.
identity
()));
return
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
CTerminalUserModel:
:
getUserId
,
Function
.
identity
()));
}
}
...
...
src/main/resources/mapper/UserLocalAccountMapper.xml
View file @
e0cf398
...
@@ -62,4 +62,17 @@
...
@@ -62,4 +62,17 @@
and tcuar.auth_type = 'local'
and tcuar.auth_type = 'local'
and tcuar.user_id = #{userId} limit 1
and tcuar.user_id = #{userId} limit 1
</select>
</select>
<select
id=
"selectByUserIds"
resultType=
"cn.com.glsx.app.modules.model.CTerminalUserModel"
>
select tcuar.user_id userId, tcula.account, tcula2.username, tcula2.avatar
from t_cust_user_auth_rel tcuar
inner join t_cust_user_local_auth tcula on tcuar.auth_id = tcula.id
left join t_cust_user_local_account tcula2 on tcuar.auth_id = tcula2.auth_id
where tcuar.del_flag = 0
and tcuar.auth_type = 'local'
and tcuar.user_id in
<foreach
collection=
"userIds"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</select>
</mapper>
</mapper>
\ No newline at end of file
\ 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