| | |
| | | import com.sinata.system.domain.MwApplication; |
| | | import com.sinata.system.domain.SysDepartment; |
| | | import com.sinata.system.domain.SysDepartmentInfo; |
| | | import com.sinata.system.domain.SysUserDepartment; |
| | | import com.sinata.system.domain.dto.DisposalUnitDTO; |
| | | import com.sinata.system.domain.dto.MedicalInstitutionDTO; |
| | | import com.sinata.system.domain.dto.RegulatoryUnitDTO; |
| | |
| | | import com.sinata.system.domain.vo.SysDepartmentVO; |
| | | import com.sinata.system.enums.DepartmentEnum; |
| | | import com.sinata.system.mapper.SysDepartmentMapper; |
| | | import com.sinata.system.service.ISysUserService; |
| | | import com.sinata.system.service.SysDepartmentInfoService; |
| | | import com.sinata.system.service.SysDepartmentService; |
| | | import com.sinata.system.service.SysUserDepartmentService; |
| | |
| | | private final SysUserDepartmentService sysUserDepartmentService; |
| | | private final RedisTemplate<Object, Object> redisTemplate; |
| | | private final SysDepartmentInfoService sysDepartmentInfoService; |
| | | private final ISysUserService sysUserService; |
| | | /** |
| | | * 获取区域树 |
| | | * @return |
| | |
| | | .orderByDesc(SysDepartment::getCreateTime) |
| | | .list(); |
| | | List<Long> departmentIds = sysDepartmentList.stream().map(SysDepartment::getId).collect(Collectors.toList()); |
| | | Long count = sysUserDepartmentService.lambdaQuery().in(SysUserDepartment::getDepartmentId, departmentIds).count(); |
| | | Long count = sysUserService.lambdaQuery().in(SysUser::getDepartmentId, departmentIds).count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("该区域已存在用户,无法删除"); |
| | | throw new ServiceException("该区域已关联用户,无法删除"); |
| | | } |
| | | removeById(id); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public void deleteMedical(Long id) { |
| | | Long count = sysUserDepartmentService.lambdaQuery().eq(SysUserDepartment::getDepartmentId, id).count(); |
| | | Long count = sysUserService.lambdaQuery().eq(SysUser::getDepartmentId, id).count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("该医疗机构已存在用户,无法删除"); |
| | | throw new ServiceException("该医疗机构已关联用户,无法删除"); |
| | | } |
| | | removeById(id); |
| | | } |
| | |
| | | |
| | | @Override |
| | | public void deleteDisposalUnit(Long id) { |
| | | Long count = sysUserDepartmentService.lambdaQuery().eq(SysUserDepartment::getDepartmentId, id).count(); |
| | | Long count = sysUserService.lambdaQuery().eq(SysUser::getDepartmentId, id).count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("该处置单位构已存在用户,无法删除"); |
| | | throw new ServiceException("该处置单位构已关联用户,无法删除"); |
| | | } |
| | | removeById(id); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public void deleteRegulatoryUnit(Long id) { |
| | | Long count = sysUserDepartmentService.lambdaQuery().eq(SysUserDepartment::getDepartmentId, id).count(); |
| | | Long count = sysUserService.lambdaQuery().eq(SysUser::getDepartmentId, id).count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("该监管单位构已存在用户,无法删除"); |
| | | throw new ServiceException("该监管单位构已关联用户,无法删除"); |
| | | } |
| | | removeById(id); |
| | | } |