mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 13:22:07 +08:00
用户管理:已有认证密码账户不允许修改手机号账号
This commit is contained in:
+1
-1
@@ -171,7 +171,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT username FROM system_users WHERE id = #{id} FOR UPDATE")
|
||||
@Select("SELECT username, password FROM system_users WHERE id = #{id} FOR UPDATE")
|
||||
AdminUserDO selectByIdForUpdate(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
|
||||
+6
-5
@@ -78,6 +78,7 @@ import static com.cf.imes.framework.common.util.collection.CollectionUtils.conve
|
||||
import static com.cf.imes.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static com.cf.imes.module.system.dal.redis.RedisKeyConstants.OAUTH2_ACCESS_TOKEN;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.USER_ME_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.USER_MOBILE_UPDATE_NOT_ALLOW_ERROR;
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.USER_OPERATE_SELF_STATUS_ERROR;
|
||||
|
||||
/**
|
||||
@@ -200,11 +201,11 @@ public class AdminUserServiceImpl implements AdminUserService {
|
||||
Long id = updateObj.getId();
|
||||
if (ObjectUtil.isNotNull(id)) {
|
||||
AdminUserDO adminUserDO = userMapper.selectByIdForUpdate(id);
|
||||
// 当手机号(账号)发生改变时,清空密码
|
||||
if (ObjectUtil.isNotNull(adminUserDO) && !Objects.equals(adminUserDO.getUsername(), mobile)) {
|
||||
// 清空密码
|
||||
updateObj.setPassword("");
|
||||
updateObj.setUsername(mobile);
|
||||
// 当手机号(账号)发生改变时,只允许密码为空的通过(还没有使用验证码来设置过密码)
|
||||
if (ObjectUtil.isNotNull(adminUserDO) && !StringUtils.equals(adminUserDO.getUsername(), mobile)) {
|
||||
if(StringUtils.isNotEmpty(adminUserDO.getPassword())) {
|
||||
throw ServiceExceptionUtil.exception(USER_MOBILE_UPDATE_NOT_ALLOW_ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
userMapper.updateById(updateObj);
|
||||
|
||||
Reference in New Issue
Block a user