用户可以修改相同手机号修复
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.czg.account.dto.shopuser;
|
package com.czg.account.dto.shopuser;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -16,6 +17,7 @@ public class ShopUserEditDTO {
|
|||||||
/**
|
/**
|
||||||
* 昵称
|
* 昵称
|
||||||
*/
|
*/
|
||||||
|
@Size(min = 1, message = "昵称不为空")
|
||||||
private String nickName;
|
private String nickName;
|
||||||
/**
|
/**
|
||||||
* 性别 0女 1男
|
* 性别 0女 1男
|
||||||
@@ -24,9 +26,11 @@ public class ShopUserEditDTO {
|
|||||||
/**
|
/**
|
||||||
* 生日
|
* 生日
|
||||||
*/
|
*/
|
||||||
|
@Size(min = 1, message = "生日不为空")
|
||||||
private String birthDay;
|
private String birthDay;
|
||||||
/**
|
/**
|
||||||
* 手机号
|
* 手机号
|
||||||
*/
|
*/
|
||||||
|
@Size(min = 1, message = "手机号不为空")
|
||||||
private String phone;
|
private String phone;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean updateInfo(Long shopId, ShopUserEditDTO shopUserEditDTO) {
|
public Boolean updateInfo(Long shopId, ShopUserEditDTO shopUserEditDTO) {
|
||||||
|
long count = count(new QueryWrapper().eq(ShopUser::getShopId, shopId).eq(ShopUser::getPhone, shopUserEditDTO.getPhone()).ne(ShopUser::getId, shopUserEditDTO.getId()));
|
||||||
|
if (count > 0) {
|
||||||
|
throw new ApiNotPrintException("手机号已存在");
|
||||||
|
}
|
||||||
ShopUser shopUser = getUserInfo(shopId, shopUserEditDTO.getId());
|
ShopUser shopUser = getUserInfo(shopId, shopUserEditDTO.getId());
|
||||||
BeanUtil.copyProperties(shopUserEditDTO, shopUser);
|
BeanUtil.copyProperties(shopUserEditDTO, shopUser);
|
||||||
return updateById(shopUser);
|
return updateById(shopUser);
|
||||||
|
|||||||
Reference in New Issue
Block a user