From dde5d6a26bee2f915f689abc9cc813107ac9c233 Mon Sep 17 00:00:00 2001 From: "JinLu.Yin" <411641505@qq.com> Date: Mon, 13 Jun 2022 14:18:46 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=B1=BB=E5=9E=8B=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=B6=E9=AA=8C=E8=AF=81=E8=AE=BE=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dv/controller/DvMachineryTypeController.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvMachineryTypeController.java b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvMachineryTypeController.java index 8f3bb53..d2367b2 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvMachineryTypeController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/dv/controller/DvMachineryTypeController.java @@ -3,7 +3,10 @@ package com.ktg.mes.dv.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import cn.hutool.core.collection.CollUtil; import com.ktg.common.constant.UserConstants; +import com.ktg.mes.dv.domain.DvMachinery; +import com.ktg.mes.dv.service.IDvMachineryService; import com.ktg.system.strategy.AutoCodeUtil; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -36,6 +39,9 @@ public class DvMachineryTypeController extends BaseController @Autowired private IDvMachineryTypeService dvMachineryTypeService; + @Autowired + private IDvMachineryService dvMachineryService; + @Autowired private AutoCodeUtil autoCodeUtil; /** @@ -103,6 +109,16 @@ public class DvMachineryTypeController extends BaseController @DeleteMapping("/{machineryTypeIds}") public AjaxResult remove(@PathVariable Long[] machineryTypeIds) { + for (Long typeId:machineryTypeIds + ) { + DvMachinery param = new DvMachinery(); + param.setMachineryId(typeId); + List machinerys = dvMachineryService.selectDvMachineryList(param); + if(CollUtil.isNotEmpty(machinerys)){ + return AjaxResult.error("设备类型下已配置了设备,不能删除!"); + } + } + return toAjax(dvMachineryTypeService.deleteDvMachineryTypeByMachineryTypeIds(machineryTypeIds)); } }