|
@@ -293,23 +293,27 @@ public class UserService implements IUserService {
|
|
|
|
|
|
@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)
|
|
|
+ //通过手机号模糊查找
|
|
|
+ List<UserAccount> userAccountList = userAccountService.list(new QueryWrapper<UserAccount>().
|
|
|
+ select("user_id").like("mobile", 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;
|
|
|
+ //通过用户名称模糊查找用户信息
|
|
|
+ List<UserInfo> userInfoList = userInfoService.list(new QueryWrapper<UserInfo>().
|
|
|
+ select("user_id").like("name", queryCondition)
|
|
|
+ );
|
|
|
+ List<Long> userIdList = new ArrayList<>();
|
|
|
+ //将用户id封装到集合中
|
|
|
+ if (userAccountList != null && userAccountList.size() > 0) {
|
|
|
+ userIdList.addAll(userAccountList.stream().map(UserAccount::getUserId)
|
|
|
+ .collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ if (userInfoList != null && userInfoList.size() > 0) {
|
|
|
+ userIdList.addAll(userInfoList.stream().map(UserInfo::getUserId)
|
|
|
+ .collect(Collectors.toList()));
|
|
|
+ }
|
|
|
+ //列表去重
|
|
|
+ ProjectUtils.removeDuplicateWithOrder(userIdList);
|
|
|
+ return userIdList;
|
|
|
}
|
|
|
|
|
|
@Override
|