This commit is contained in:
hucs
2024-06-14 18:00:21 +08:00
parent 12422d8c06
commit bc89723853
2 changed files with 9 additions and 4 deletions

View File

@@ -270,6 +270,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUserEntity
if (user.getMobile().equals(param.getMobile())) {
throw new RuntimeException("新旧手机号不能相同~");
}
this.update(Wrappers.lambdaUpdate(SysUserEntity.class).eq(SysUserEntity::getUserId, param.getUserId()).set(SysUserEntity::getMobile, param.getMobile()));
// 查询是否已有相同手机号
long count = this.count(Wrappers.lambdaQuery(SysUserEntity.class).eq(SysUserEntity::getMobile, param.getMobile()).ne(SysUserEntity::getUserId, param.getUserId()));
if (count > 0) {
throw new RuntimeException("系统中已有该手机号,无法录入~");
}
this.update(Wrappers.lambdaUpdate(SysUserEntity.class).eq(SysUserEntity::getUserId, param.getUserId()).set(SysUserEntity::getUserCode, param.getMobile()).set(SysUserEntity::getMobile, param.getMobile()));
}
}

View File

@@ -1,6 +1,6 @@
package com.starry.common.utils;
import java.util.UUID;
import cn.hutool.core.util.RandomUtil;
/**
* @author admin
@@ -10,11 +10,11 @@ public class IdUtils {
/**
* 生成16位的UUID
* 生成8位的UUID
*
* @return UUID
*/
public static String getUuid() {
return UUID.randomUUID().toString().replaceAll("-", "").substring(0, 12);
return RandomUtil.randomString(8);
}
}