Commit e8d4399a by guojuxing

新增管理员验证手机号码重复,不同企业可以重复

parent 81999241
......@@ -61,9 +61,10 @@ public interface TabSysUserMapper {
* 手机号码查询个数
* @param phone
* @param userId
* @param enterpriseId
* @return
*/
int countByPhone(@Param("phone") String phone, @Param("userId") Integer userId);
int countByPhone(@Param("phone") String phone, @Param("userId") Integer userId, @Param("enterpriseId") Integer enterpriseId);
TabSysUser selectByEnterpriseId(@Param("enterpriseId") Integer enterpriseId);
......
......@@ -34,9 +34,10 @@ public interface UserService {
* 手机号码是否重复
* @param userId
* @param phone
* @param enterpriseId
* @return
*/
boolean isPhoneRepeat(Integer userId, String phone);
boolean isPhoneRepeat(Integer userId, String phone, Integer enterpriseId);
TabSysUser getUserByEnterpriseId(Integer enterpriseId);
......
......@@ -46,8 +46,8 @@ public class UserServiceImpl implements UserService {
}
@Override
public boolean isPhoneRepeat(Integer userId, String phone) {
int count = tabSysUserMapper.countByPhone(phone, userId);
public boolean isPhoneRepeat(Integer userId, String phone, Integer enterpriseId) {
int count = tabSysUserMapper.countByPhone(phone, userId, enterpriseId);
if (count > 0) {
return true;
}
......
......@@ -56,7 +56,7 @@ public class UserApiServiceImpl implements UserApiService {
if (!paramResult.isSuccess()) {
return paramResult;
}
if (userService.isPhoneRepeat(null, userDTO.getPhoneNumber())) {
if (userService.isPhoneRepeat(null, userDTO.getPhoneNumber(), userDTO.getEnterpriseId())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "手机号码不能重复");
}
......@@ -121,7 +121,7 @@ public class UserApiServiceImpl implements UserApiService {
if (tabUser == null) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "用户ID输入有误");
}
if (userService.isPhoneRepeat(userDTO.getUserId(), userDTO.getPhoneNumber())) {
if (userService.isPhoneRepeat(userDTO.getUserId(), userDTO.getPhoneNumber(), tabUser.getEnterpriseId())) {
return ServiceResponse.failure(ErrorCode.PARAMETER_ERROR.getCode(), "手机号码不能重复");
}
......
......@@ -193,6 +193,7 @@
<if test="userId != null">
and user_id <![CDATA[ <> ]]> #{userId}
</if>
and enterprise_id = #{enterpriseId}
and phone_number = #{phone}
</select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment