| | |
| | | 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> |
| | |
| | | } |
| | | |
| | | @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 |