|
@@ -144,7 +144,7 @@ public class UserService implements IUserService {
|
|
|
|
|
|
@Override
|
|
|
public UserResponse getLoginUserInfo(Long userId) {
|
|
|
- UserResponse userResponse = new UserResponse();
|
|
|
+ UserResponse userResponse = new UserResponse();
|
|
|
userResponse.setUserId(userId);
|
|
|
//获取用户的基本信息
|
|
|
UserAccount userAccount = userAccountService.getByUserId(userId);
|
|
@@ -181,7 +181,7 @@ public class UserService implements IUserService {
|
|
|
@Override
|
|
|
public Map<Long, UserResponse> getUserResponseByUserIdList(List<Long> userIdList) {
|
|
|
Map<Long, UserResponse> userIdToUserResponse = new HashMap<>();
|
|
|
- if(userIdList != null && userIdList.size() > 0){
|
|
|
+ if (userIdList != null && userIdList.size() > 0) {
|
|
|
//获取用户账号信息
|
|
|
List<UserAccount> userAccountList = (List<UserAccount>) userAccountService.listByIds(userIdList);
|
|
|
//获取用户基本信息
|
|
@@ -189,10 +189,10 @@ public class UserService implements IUserService {
|
|
|
//将数据转化为userId -> 用户信息的map
|
|
|
Map<Long, UserAccount> userIdToUserAccount = ProjectUtils.attrToObjMap(userAccountList, "userId", null);
|
|
|
Map<Long, UserInfo> userIdToUserInfo = ProjectUtils.attrToObjMap(userInfoList, "userId", null);
|
|
|
- for(Long userId:userIdList){
|
|
|
+ for (Long userId : userIdList) {
|
|
|
UserAccount userAccount = userIdToUserAccount.get(userId);
|
|
|
UserInfo userInfo = userIdToUserInfo.get(userId);
|
|
|
- if(userAccount != null && userInfo != null){
|
|
|
+ if (userAccount != null && userInfo != null) {
|
|
|
UserResponse userResponse = new UserResponse();
|
|
|
userResponse.setName(userInfo.getName());
|
|
|
userResponse.setMobile(userAccount.getMobile());
|
|
@@ -204,4 +204,25 @@ public class UserService implements IUserService {
|
|
|
return userIdToUserResponse;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<Long> getIdListByQueryCondition(String queryCondition) {
|
|
|
+ List<UserAccount> userAccountList = userAccountService.list(new QueryWrapper<UserAccount>()
|
|
|
+ .select("user_id")
|
|
|
+ //通过手机号模糊查找
|
|
|
+ .like("mobile", queryCondition));
|
|
|
+ List<UserInfo> userInfoList = userInfoService.list(new QueryWrapper<UserInfo>()
|
|
|
+ .select("user_id")
|
|
|
+ //通过用户名模糊查找
|
|
|
+ .like("name", queryCondition)
|
|
|
+ );
|
|
|
+ //获取通过手机号模糊查询出来的用户id
|
|
|
+ List<Long> accountUserIdList = ProjectUtils.getAttrList(userAccountList, "userId", null);
|
|
|
+ //获取通过用户名模糊查询出来的用户id
|
|
|
+ List<Long> infoUserIdList = ProjectUtils.getAttrList(userInfoList, "userId", null);
|
|
|
+ //合并去重
|
|
|
+ accountUserIdList.addAll(infoUserIdList);
|
|
|
+ ProjectUtils.removeDuplicateWithOrder(accountUserIdList);
|
|
|
+ return accountUserIdList;
|
|
|
+ }
|
|
|
+
|
|
|
}
|