员工账号修改接口
This commit is contained in:
parent
42d415377d
commit
2c2d0cb606
|
|
@ -26,6 +26,11 @@ public class ShopStaffEditDTO {
|
|||
* 员工姓名
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 登录账号
|
||||
*/
|
||||
@NotEmpty(message = "账号不为空")
|
||||
private String accountName;
|
||||
/**
|
||||
* 登录密码
|
||||
*/
|
||||
|
|
@ -33,10 +38,12 @@ public class ShopStaffEditDTO {
|
|||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@NotEmpty(message = "手机号不为空")
|
||||
private String phone;
|
||||
/**
|
||||
* 员工编号
|
||||
*/
|
||||
@NotEmpty(message = "编号不为空")
|
||||
private String code;
|
||||
/**
|
||||
* 优惠类型 1 折扣 0 金额
|
||||
|
|
|
|||
|
|
@ -65,7 +65,25 @@ public class ShopStaffServiceImpl extends ServiceImpl<ShopStaffMapper, ShopStaff
|
|||
sysUsersRolesService.updateRole(shopStaff.getId(), shopStaffEditDTO.getRoleId());
|
||||
}
|
||||
|
||||
sysUserService.updateSysUserPwd(shopStaff.getId(), shopStaffEditDTO.getAccountPwd());
|
||||
if (!"*******".equals(shopStaffEditDTO.getAccountPwd())) {
|
||||
sysUserService.updateSysUserPwd(shopStaff.getId(), shopStaffEditDTO.getAccountPwd());
|
||||
}
|
||||
|
||||
SysUser sysUser = sysUserService.getById(sysUserId);
|
||||
if (!shopStaffEditDTO.getPhone().equals(sysUser.getPhone())) {
|
||||
sysUser.setPhone(shopStaffEditDTO.getPhone());
|
||||
}
|
||||
|
||||
if (!shopStaffEditDTO.getAccountName().equals(sysUser.getAccount())) {
|
||||
long count = sysUserService.count(new QueryWrapper().eq(SysUser::getAccount, shopStaffEditDTO.getAccountName()));
|
||||
if (count > 0) {
|
||||
throw new ApiNotPrintException("此账户名已存在");
|
||||
}
|
||||
sysUser.setAccount(shopStaffEditDTO.getAccountName());
|
||||
}
|
||||
sysUserService.updateById(sysUser);
|
||||
|
||||
|
||||
BeanUtil.copyProperties(shopStaffEditDTO, shopStaff);
|
||||
updateById(shopStaff);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue