员工修改bug修复

This commit is contained in:
张松
2025-03-03 10:20:54 +08:00
parent df69bfcb40
commit 152e2261e8
2 changed files with 8 additions and 3 deletions

View File

@@ -77,12 +77,13 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
sysUser.setPhone(shopStaffEditDTO.getPhone());
}
if (StrUtil.isNotBlank(shopStaffEditDTO.getAccountName()) && !shopStaffEditDTO.getAccountName().equals(sysUser.getAccount())) {
long count = sysUserService.count(new QueryWrapper().eq(SysUser::getAccount, shopStaffEditDTO.getAccountName()).ne(SysUser::getId, sysUser.getId()));
String accountName = StpKit.USER.getLoginIdAsString() + "@" + shopStaffEditDTO.getAccountName();
if (StrUtil.isNotBlank(shopStaffEditDTO.getAccountName()) && !accountName.equals(sysUser.getAccount())) {
long count = sysUserService.count(new QueryWrapper().eq(SysUser::getAccount, accountName).ne(SysUser::getId, sysUser.getId()));
if (count > 0) {
throw new ApiNotPrintException("此账户名已存在");
}
sysUser.setAccount(StpKit.USER.getLoginIdAsString() + "@" + shopStaffEditDTO.getAccountName());
sysUser.setAccount(accountName);
}
sysUserService.updateById(sysUser);