|
|
@@ -1,11 +1,14 @@
|
|
|
package com.ktg.iscs.service.impl;
|
|
|
|
|
|
import cn.hutool.core.lang.Assert;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ktg.common.core.text.Convert;
|
|
|
import com.ktg.common.utils.DateUtils;
|
|
|
+import com.ktg.iscs.domain.IsIsolationPoint;
|
|
|
import com.ktg.iscs.domain.IsLockType;
|
|
|
import com.ktg.iscs.mapper.IsLockTypeMapper;
|
|
|
+import com.ktg.iscs.service.IIsIsolationPointService;
|
|
|
import com.ktg.iscs.service.IIsLockTypeService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -23,6 +26,8 @@ public class IsLockTypeServiceImpl extends ServiceImpl<IsLockTypeMapper, IsLockT
|
|
|
{
|
|
|
@Autowired
|
|
|
private IsLockTypeMapper isLockTypeMapper;
|
|
|
+ @Autowired
|
|
|
+ private IIsIsolationPointService iIsIsolationPointService;
|
|
|
|
|
|
/**
|
|
|
* 查询物资类型
|
|
|
@@ -85,6 +90,13 @@ public class IsLockTypeServiceImpl extends ServiceImpl<IsLockTypeMapper, IsLockT
|
|
|
{
|
|
|
Assert.notBlank(lockTypeIds, "请选择需要删除的数据!");
|
|
|
Long[] longIds = Convert.toLongArray(lockTypeIds);
|
|
|
+ // 判断下面有没有子类,有则不能删除
|
|
|
+ List<IsLockType> lockTypeList = list(Wrappers.<IsLockType>lambdaQuery().in(IsLockType::getParentTypeId, longIds));
|
|
|
+ Assert.isTrue(lockTypeList.isEmpty(), "选中的类别下存在子类,不可删除!");
|
|
|
+ // 判断有没有点位使用该类别,有的话不能删
|
|
|
+ List<IsIsolationPoint> pointList = iIsIsolationPointService.list(Wrappers.<IsIsolationPoint>lambdaQuery()
|
|
|
+ .in(IsIsolationPoint::getLockTypeId, longIds));
|
|
|
+ Assert.isTrue(pointList.isEmpty(), "选中的类别下有被隔离点正在使用的,不可删除!");
|
|
|
return isLockTypeMapper.deleteIsLockTypeByLockTypeIds(longIds);
|
|
|
}
|
|
|
|