shenyijian
2024-08-02 d605db1953fbd3ca4809dbb45e551b98667890e9
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/service/impl/SgGxStepServiceImpl.java
@@ -19,8 +19,10 @@
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
 * <p>
@@ -57,16 +59,19 @@
   }
   @Override
   public void delete(String id) {
      SgGxStepDO sgGxStepDO = sgGxStepMapper.selectById(id);
      if (!new LambdaQueryChainWrapper<>(sgGxRoleMapper).eq(SgGxRoleDO::getGxStepId,id).list().isEmpty()){
         throw  new ServiceException(sgGxStepDO.getGxStepName()+ "已绑定角色,无法删除");
   public void delete(String ids) {
      List<String> idList = Stream.of(ids.split(",")).sorted(Comparator.reverseOrder()) .collect(Collectors.toList());
      for (String id : idList) {
         SgGxStepDO sgGxStepDO = sgGxStepMapper.selectById(id);
         if (!new LambdaQueryChainWrapper<>(sgGxRoleMapper).eq(SgGxRoleDO::getGxStepId,id).list().isEmpty()){
            throw  new ServiceException(sgGxStepDO.getGxStepName()+ "已绑定角色,无法删除");
         }
         List<SgGxStepDO> list= sgGxStepMapper.selectByGxInfoId(sgGxStepDO.getGxInfoId());
         if (!sgGxStepDO.getGxStepNum().equals(list.get(0).getGxStepNum())){
            throw  new ServiceException("请按顺序删除工序步骤");
         }
         this.removeById(id);
      }
      List<SgGxStepDO> list= sgGxStepMapper.selectByGxInfoId(sgGxStepDO.getGxInfoId());
      if (!sgGxStepDO.getGxStepNum().equals(list.get(0).getGxStepNum())){
         throw  new ServiceException("请按顺序删除工序步骤");
      }
      this.removeById(id);
   }
   @Override