| | |
| | | import cn.iocoder.yudao.module.mes.controller.admin.safety.vo.unit.MesSafetyRiskUnitPageReqVO; |
| | | import cn.iocoder.yudao.module.mes.controller.admin.safety.vo.unit.MesSafetyRiskUnitSaveReqVO; |
| | | import cn.iocoder.yudao.module.mes.dal.dataobject.safety.MesSafetyRiskUnitDO; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.safety.MesSafetyHazardMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.safety.MesSafetyRiskMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.safety.MesSafetyRiskUnitMapper; |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.safety.MesSafetyWorkTicketMapper; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.validation.annotation.Validated; |
| | |
| | | |
| | | @Resource |
| | | private MesSafetyRiskMapper riskMapper; |
| | | |
| | | @Resource |
| | | private MesSafetyHazardMapper hazardMapper; |
| | | |
| | | @Resource |
| | | private MesSafetyWorkTicketMapper ticketMapper; |
| | | |
| | | @Override |
| | | public PageResult<MesSafetyRiskUnitDO> getRiskUnitPage(MesSafetyRiskUnitPageReqVO pageReqVO) { |
| | |
| | | if (riskCount != null && riskCount > 0) { |
| | | throw exception(MES_SAFETY_RISK_UNIT_HAS_RISK); |
| | | } |
| | | // 已被隐患引用的单元也不允许删除 |
| | | Long hazardCount = hazardMapper.selectCountByUnitId(id); |
| | | if (hazardCount != null && hazardCount > 0) { |
| | | throw exception(MES_SAFETY_HAZARD_HAS_REFERENCE); |
| | | } |
| | | // 已被作业票引用的单元也不允许删除 |
| | | Long ticketCount = ticketMapper.selectCountByUnitId(id); |
| | | if (ticketCount != null && ticketCount > 0) { |
| | | throw exception(MES_SAFETY_TICKET_HAS_REFERENCE); |
| | | } |
| | | riskUnitMapper.deleteById(id); |
| | | } |
| | | |