用户可以修改相同手机号修复
This commit is contained in:
parent
8de08b17cd
commit
fd257f1b3b
|
|
@ -1,6 +1,7 @@
|
|||
package com.czg.account.dto.shopuser;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -16,6 +17,7 @@ public class ShopUserEditDTO {
|
|||
/**
|
||||
* 昵称
|
||||
*/
|
||||
@Size(min = 1, message = "昵称不为空")
|
||||
private String nickName;
|
||||
/**
|
||||
* 性别 0女 1男
|
||||
|
|
@ -24,9 +26,11 @@ public class ShopUserEditDTO {
|
|||
/**
|
||||
* 生日
|
||||
*/
|
||||
@Size(min = 1, message = "生日不为空")
|
||||
private String birthDay;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@Size(min = 1, message = "手机号不为空")
|
||||
private String phone;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,6 +85,10 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||
|
||||
@Override
|
||||
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());
|
||||
BeanUtil.copyProperties(shopUserEditDTO, shopUser);
|
||||
return updateById(shopUser);
|
||||
|
|
|
|||
Loading…
Reference in New Issue