feat:add phone query api
This commit is contained in:
parent
154b2ac47a
commit
8e3966b54b
@ -170,4 +170,17 @@ public class UserController {
|
|||||||
return success(userService.importUserList(list, updateSupport));
|
return success(userService.importUserList(list, updateSupport));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get/phone")
|
||||||
|
@Operation(summary = "手机号查询用户")
|
||||||
|
@Parameter(name = "phone", description = "手机号", required = true, example = "15898763434")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:user:query')")
|
||||||
|
public CommonResult<UserRespVO> getUser(@RequestParam("phone") String phone) {
|
||||||
|
AdminUserDO user = userService.getUserByPhone(phone);
|
||||||
|
if (user == null) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
|
// 拼接数据
|
||||||
|
DeptDO dept = deptService.getDept(user.getDeptId());
|
||||||
|
return success(UserConvert.INSTANCE.convert(user, dept));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,4 +214,6 @@ public interface AdminUserService {
|
|||||||
*/
|
*/
|
||||||
AdminUserDO getUserByOpenId(String openId);
|
AdminUserDO getUserByOpenId(String openId);
|
||||||
|
|
||||||
|
AdminUserDO getUserByPhone(String phone);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -529,4 +529,22 @@ public class AdminUserServiceImpl implements AdminUserService {
|
|||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AdminUserDO getUserByPhone(String phone) {
|
||||||
|
LambdaQueryWrapperX<AdminUserDO> queryWrapperX = new LambdaQueryWrapperX<>();
|
||||||
|
queryWrapperX.eq(AdminUserDO::getMobile, phone);
|
||||||
|
List<AdminUserDO> users = userMapper.selectList(queryWrapperX);
|
||||||
|
if (users.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
AdminUserDO user = users.get(0);
|
||||||
|
Integer status = user.getStatus();
|
||||||
|
|
||||||
|
if (Objects.equals(status, CommonStatusEnum.DISABLE.getStatus())) {
|
||||||
|
throw exception(AUTH_LOGIN_USER_DISABLED);
|
||||||
|
} else {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user