| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.system.api.constant.AppErrorConstant; |
| | | import com.ruoyi.system.api.domain.dto.MgtBaseGetDto; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.domain.dto.MgtStaffEditDto; |
| | |
| | | public void mgtStaffEdit(MgtStaffEditDto mgtStaffEditDto){ |
| | | SysStaff sysStaff; |
| | | SysUser sysUser; |
| | | LambdaQueryWrapper<SysStaff> queryWrapper = new LambdaQueryWrapper(); |
| | | queryWrapper.eq(SysStaff::getDelFlag,0); |
| | | queryWrapper.eq(SysStaff::getStaffMobile,mgtStaffEditDto.getStaffMobile()); |
| | | SysStaff sysStaffSame = this.getOne(queryWrapper, false); |
| | | if(mgtStaffEditDto.getSysUserId()!=null){ |
| | | if(sysStaffSame!=null&&!sysStaffSame.getUserId().equals(mgtStaffEditDto.getSysUserId())){ |
| | | throw new ServiceException(AppErrorConstant.STAFF_MOBILE_DOUBLE); |
| | | } |
| | | sysStaff = this.getByUserId(mgtStaffEditDto.getSysUserId()); |
| | | sysUser = sysUserService.selectUserById(mgtStaffEditDto.getSysUserId()); |
| | | sysUser.setUserName(mgtStaffEditDto.getStaffMobile()); |
| | |
| | | sysUser.setEmail(mgtStaffEditDto.getStaffEmail()); |
| | | sysUserService.updateOnlyUser(sysUser); |
| | | }else{ |
| | | if(sysStaffSame!=null){ |
| | | throw new ServiceException(AppErrorConstant.STAFF_MOBILE_DOUBLE); |
| | | } |
| | | sysStaff = new SysStaff(); |
| | | String staffId = IdUtils.simpleUUID(); |
| | | sysStaff.setStaffId(staffId); |