|
@@ -14,6 +14,7 @@ import com.platform.dao.entity.sb.SbInfo;
|
|
|
import com.platform.dao.entity.sb.SbPosition;
|
|
|
import com.platform.dao.enums.IconEnum;
|
|
|
import com.platform.dao.enums.SbTreeTypeEnum;
|
|
|
+import com.platform.dao.enums.YesNoEnum;
|
|
|
import com.platform.dao.mapper.part.PartInfoMapper;
|
|
|
import com.platform.dao.mapper.sb.SbInfoMapper;
|
|
|
import com.platform.dao.mapper.sb.SbPositionMapper;
|
|
@@ -26,6 +27,7 @@ import com.platform.service.base.impl.BaseServiceImpl;
|
|
|
import com.platform.service.sb.SbPositionService;
|
|
|
import com.platform.service.util.ExecuteSql;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import tk.mybatis.mapper.weekend.Weekend;
|
|
|
import tk.mybatis.mapper.weekend.WeekendCriteria;
|
|
@@ -50,12 +52,30 @@ public class SbPositionServiceImpl extends BaseServiceImpl<SbPositionMapper, SbP
|
|
|
|
|
|
private final SbInfoMapper sbInfoMapper;
|
|
|
|
|
|
+ @Override
|
|
|
+ public void deleteByPrimaryKey(String id) {
|
|
|
+
|
|
|
+ SbPosition sbPosition = mapper.selectByPrimaryKey(id);
|
|
|
+ if(sbPosition!=null && sbPosition.getOpcFlag()== YesNoEnum.YES.getValue()){
|
|
|
+ throw new BusinessException("该车间是有工艺流程画面,无法删除");
|
|
|
+ }
|
|
|
+
|
|
|
+ Weekend<SbInfo> weekend2 = new Weekend<>(SbInfo.class);
|
|
|
+ WeekendCriteria<SbInfo, Object> weekendCriteria2 = weekend2.weekendCriteria();
|
|
|
+ weekendCriteria2.andEqualTo(SbInfo::getPositionId, id);
|
|
|
+ List<SbInfo> sbInfoList = sbInfoMapper.selectByExample(weekend2);
|
|
|
+ if(!CollectionUtils.isEmpty(sbInfoList)){
|
|
|
+ throw new BusinessException("该车间下面有设备,无法删除,请先转移设备到其他车间");
|
|
|
+ }
|
|
|
+
|
|
|
+ super.deleteByPrimaryKey(id);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public int batchDelete(List<String> ids) {
|
|
|
- Weekend<SbPosition> weekend = new Weekend<>(SbPosition.class);
|
|
|
- WeekendCriteria<SbPosition, Object> weekendCriteria = weekend.weekendCriteria();
|
|
|
- weekendCriteria.andIn(SbPosition::getId, ids);
|
|
|
- mapper.deleteByExample(weekend);
|
|
|
+ for(String id:ids){
|
|
|
+ this.deleteByPrimaryKey(id);
|
|
|
+ }
|
|
|
return 1;
|
|
|
}
|
|
|
|