员工账号修改

This commit is contained in:
张松
2025-02-28 15:53:26 +08:00
parent 5490169414
commit 7464da48d3

View File

@@ -61,6 +61,9 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
public Boolean edit(ShopStaffEditDTO shopStaffEditDTO) {
long sysUserId = StpKit.USER.getLoginIdAsLong();
ShopStaff shopStaff = queryChain().eq(ShopStaff::getShopId, sysUserId).eq(ShopStaff::getId, shopStaffEditDTO.getId()).one();
if (shopStaff == null) {
throw new ApiNotPrintException("员工账户不存在");
}
if (shopStaffEditDTO.getRoleId() != null) {
sysUsersRolesService.updateRole(shopStaff.getId(), shopStaffEditDTO.getRoleId());
}
@@ -69,7 +72,7 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
sysUserService.updateSysUserPwd(shopStaff.getId(), shopStaffEditDTO.getAccountPwd());
}
SysUser sysUser = sysUserService.getById(sysUserId);
SysUser sysUser = sysUserService.getById(shopStaff.getId());
if (StrUtil.isNotBlank(shopStaffEditDTO.getPhone()) && !shopStaffEditDTO.getPhone().equals(sysUser.getPhone())) {
sysUser.setPhone(shopStaffEditDTO.getPhone());
}