zy 7 meses atrás
pai
commit
69546928d2

+ 6 - 0
bus-biz/src/main/java/bus/service/impl/BCourseInfoServiceImpl.java

@@ -427,6 +427,12 @@ public class BCourseInfoServiceImpl extends ServiceImpl<BCourseInfoMapper, BCour
         QueryWrapper<BCourseBusPo> queryWrapper2 = new QueryWrapper<>();
         queryWrapper2.eq("course_id", id);
         bCourseBusService.remove(queryWrapper2);
+        QueryWrapper<BCoursePrePo> queryWrapper3 = new QueryWrapper<>();
+        queryWrapper3.eq("course_id", id);
+        bCoursePreService.remove(queryWrapper3);
+        QueryWrapper<BUserCoursePo> queryWrapper4= new QueryWrapper<>();
+        queryWrapper4.eq("course_id", id);
+        bUserCourseService.remove(queryWrapper4);
 		bCourseInfoMapper.deleteById(id);
     }
 

+ 10 - 0
bus-biz/src/main/java/bus/service/impl/BStationInfoServiceImpl.java

@@ -1,11 +1,13 @@
 package bus.service.impl;
 
+import bus.mapper.BCourseStationMapper;
 import bus.model.SnowflakeUtil;
 import bus.model.dto.BStationInfoDto;
 import bus.model.dto.BStationInfoPageDto;
 import bus.model.dto.StationTypeDto;
 import bus.model.enums.StationTypeEnum;
 import bus.model.po.BBusInfoPo;
+import bus.model.po.BCourseStationPo;
 import bus.model.vo.BStationInfoVo;
 import bus.model.po.BStationInfoPo;
 import bus.mapper.BStationInfoMapper;
@@ -41,6 +43,8 @@ public class BStationInfoServiceImpl extends ServiceImpl<BStationInfoMapper, BSt
     private BStationInfoMapper bStationInfoMapper;
     @Resource
     private SnowflakeUtil snowflakeUtil;
+    @Resource
+    private BCourseStationMapper bCourseStationMapper;
 
 	/**
      * 详情
@@ -135,6 +139,12 @@ public class BStationInfoServiceImpl extends ServiceImpl<BStationInfoMapper, BSt
      */
     @Override
     public void delete(String id){
+        //判断该站点有没有被路线绑定
+        QueryWrapper<BCourseStationPo> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("station_id", id);
+        if (bCourseStationMapper.selectList(queryWrapper).size() > 0) {
+            throw new BusinessException("该站点已被路线绑定,请先解除绑定");
+        }
 		bStationInfoMapper.deleteById(id);
     }