用户可以修改相同手机号修复

This commit is contained in:
张松
2025-03-01 15:05:30 +08:00
parent 8de08b17cd
commit fd257f1b3b
2 changed files with 8 additions and 0 deletions

View File

@@ -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);