Commit e0cf398e by levphon

用户账号处理

1 parent 6b3431c8
......@@ -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.model.AppUser;
import cn.com.glsx.app.modules.model.CTerminalUserModel;
import com.glsx.plat.mybatis.mapper.CommonBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
@Mapper
public interface UserLocalAccountMapper extends CommonBaseMapper<UserLocalAccount> {
......@@ -16,4 +20,6 @@ public interface UserLocalAccountMapper extends CommonBaseMapper<UserLocalAccoun
AppUser selectRelUserByUserId(@Param("userId") Long userId);
List<CTerminalUserModel> selectByUserIds(@Param("userIds") Collection<Long> userIds);
}
\ No newline at end of file
......@@ -13,6 +13,8 @@ import cn.hutool.core.lang.UUID;
import com.glsx.plat.common.utils.ObjectUtils;
import com.glsx.plat.jwt.base.ComJwtUser;
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.stereotype.Service;
import org.springframework.util.Assert;
......@@ -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) {
if (CollectionUtils.isEmpty(userIds)) {
return Lists.newArrayList();
}
return userWechatAccountMapper.selectByUserIds(userIds);
}
public Map<Long, CTerminalUserModel> getWechatUserMap(Collection<Long> userIds) {
List<CTerminalUserModel> userModelList = userWechatAccountMapper.selectByUserIds(userIds);
List<CTerminalUserModel> userModelList = this.getWechatUsers(userIds);
return userModelList.stream().collect(Collectors.toMap(CTerminalUserModel::getUserId, Function.identity()));
}
......
......@@ -62,4 +62,17 @@
and tcuar.auth_type = 'local'
and tcuar.user_id = #{userId} limit 1
</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>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!