소스 검색

更新删除站点功能

liu 1 년 전
부모
커밋
2346d23bcf

+ 1 - 2
src/main/java/com/sqx/modules/riderStation/controller/AdminRiderStationController.java

@@ -38,8 +38,7 @@ public class AdminRiderStationController {
     @ApiOperation("删除站点")
     @GetMapping(value = "/removeStation")
     public Result removeStation(Integer id){
-        riderStationService.removeById(id);
-        return  Result.success();
+        return riderStationService.removeStation(id);
     }
 
     @ApiOperation("站点下拉框")

+ 2 - 0
src/main/java/com/sqx/modules/riderStation/service/RiderStationService.java

@@ -17,4 +17,6 @@ public interface RiderStationService extends IService<RiderStation> {
     Result getRiderStationName(Integer userId);
 
     Result updateStation(RiderStation riderStation);
+
+    Result removeStation(Integer id);
 }

+ 12 - 0
src/main/java/com/sqx/modules/riderStation/service/impl/RiderStationServiceImpl.java

@@ -84,4 +84,16 @@ public class RiderStationServiceImpl extends ServiceImpl<RiderStationDao, RiderS
         return Result.success();
     }
 
+    @Override
+    public Result removeStation(Integer id) {
+        LambdaQueryWrapper<UserEntity> wrapper=new LambdaQueryWrapper<>();
+        wrapper.eq(UserEntity::getRiderStationId,id);
+        List<UserEntity> entityList = userDao.selectList(wrapper);
+        if (ObjectUtils.isNotEmpty(entityList)&&entityList.size()>0) {
+            return Result.error("该站点下已存在骑手");
+        }
+        this.removeById(id);
+        return Result.success();
+    }
+
 }