Commit fe791c24 authored by hkl's avatar hkl

feat:1.线路、线别、区间、车站有关联数据时不可删除

parent ca158647
...@@ -649,7 +649,7 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec ...@@ -649,7 +649,7 @@ public class MovementRecordsMasterController extends JeecgController<MovementRec
movementCourseInfoService.lambdaUpdate() movementCourseInfoService.lambdaUpdate()
// .set(jsonObject.containsKey("trackGauge"), MovementCourseInfo::getTrackCode, jsonObject.get("trackGauge")) .set(jsonObject.containsKey("trackGauge"), MovementCourseInfo::getTrackGauge, jsonObject.get("trackGauge"))
.set(jsonObject.containsKey("level"), MovementCourseInfo::getLevel, jsonObject.get("level")) // 水平 .set(jsonObject.containsKey("level"), MovementCourseInfo::getLevel, jsonObject.get("level")) // 水平
.set(jsonObject.containsKey("triangularPit"), MovementCourseInfo::getTriangularPit, jsonObject.get("triangularPit")) .set(jsonObject.containsKey("triangularPit"), MovementCourseInfo::getTriangularPit, jsonObject.get("triangularPit"))
.set(jsonObject.containsKey("direction"), MovementCourseInfo::getDirection, jsonObject.get("direction")) .set(jsonObject.containsKey("direction"), MovementCourseInfo::getDirection, jsonObject.get("direction"))
......
...@@ -10,14 +10,15 @@ import org.jeecg.common.aspect.annotation.AutoLog; ...@@ -10,14 +10,15 @@ import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItem; import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItem;
import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItemDetail; import org.jeecg.modules.checkData.entity.RailInspectionEquipmentItemDetail;
import org.jeecg.modules.checkData.vo.RailInspectionEquipmentItemDetailVO;
import org.jeecg.modules.checkData.vo.RailInspectionEquipmentItemVO;
import org.jeecg.modules.checkData.service.IRailInspectionEquipmentItemDetailService; import org.jeecg.modules.checkData.service.IRailInspectionEquipmentItemDetailService;
import org.jeecg.modules.checkData.service.IRailInspectionEquipmentItemService; import org.jeecg.modules.checkData.service.IRailInspectionEquipmentItemService;
import org.jeecg.modules.checkData.vo.RailInspectionEquipmentItemDetailVO;
import org.jeecg.modules.checkData.vo.RailInspectionEquipmentItemVO;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -97,7 +98,16 @@ public class RailInspectionEquipmentItemController extends JeecgController<RailI ...@@ -97,7 +98,16 @@ public class RailInspectionEquipmentItemController extends JeecgController<RailI
@ApiOperation(value = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-项目明细更新", notes = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-项目明细更新") @ApiOperation(value = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-项目明细更新", notes = "检查数据-动静态几何尺寸数据-轨检仪静态检查数据-项目明细更新")
@PostMapping(value = "/detailUpdateRecord") @PostMapping(value = "/detailUpdateRecord")
public Result<String> detailUpdateRecord(@RequestBody RailInspectionEquipmentItemDetail record) { public Result<String> detailUpdateRecord(@RequestBody RailInspectionEquipmentItemDetail record) {
railInspectionEquipmentItemDetailService.updateById(record);
railInspectionEquipmentItemDetailService.lambdaUpdate()
.set(RailInspectionEquipmentItemDetail::getTrackGauge, record.getTrackGauge()) // 轨距
.set(RailInspectionEquipmentItemDetail::getLevel, record.getLevel()) // 水平
.set(RailInspectionEquipmentItemDetail::getTriangularPit, record.getTriangularPit()) // 三角坑
.set(RailInspectionEquipmentItemDetail::getOther, record.getOther()) // 轨向、高低及其它
.set(RailInspectionEquipmentItemDetail::getUpdateTime, new Date())
.eq(RailInspectionEquipmentItemDetail::getId, record.getId())
.update();
return Result.OK("操作成功"); return Result.OK("操作成功");
} }
......
...@@ -112,6 +112,9 @@ ...@@ -112,6 +112,9 @@
<if test="dto.endMileage != null"> <if test="dto.endMileage != null">
AND t.centerMileage <![CDATA[ <= ]]> #{dto.endMileage} AND t.centerMileage <![CDATA[ <= ]]> #{dto.endMileage}
</if> </if>
<if test="dto.type != null and dto.type != '' ">
AND t.type = #{dto.type}
</if>
</where> </where>
ORDER BY t.startMileage ORDER BY t.startMileage
......
...@@ -11,15 +11,21 @@ import lombok.extern.slf4j.Slf4j; ...@@ -11,15 +11,21 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.subwayNetwork.dto.LineAliasQueryDTO; import org.jeecg.modules.subwayNetwork.dto.LineAliasQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LineAlias; import org.jeecg.modules.subwayNetwork.entity.LineAlias;
import org.jeecg.modules.subwayNetwork.entity.SectionStationMap;
import org.jeecg.modules.subwayNetwork.entity.TrainStation;
import org.jeecg.modules.subwayNetwork.service.ILineAliasService; import org.jeecg.modules.subwayNetwork.service.ILineAliasService;
import org.jeecg.modules.subwayNetwork.service.ISectionStationMapService;
import org.jeecg.modules.subwayNetwork.service.ITrainStationService;
import org.jeecg.modules.subwayNetwork.vo.LightAliasQueryVO; import org.jeecg.modules.subwayNetwork.vo.LightAliasQueryVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*; import java.util.*;
/** /**
...@@ -31,8 +37,11 @@ import java.util.*; ...@@ -31,8 +37,11 @@ import java.util.*;
@Slf4j @Slf4j
public class LightAliasController extends JeecgController<LineAlias, ILineAliasService> { public class LightAliasController extends JeecgController<LineAlias, ILineAliasService> {
@Autowired @Resource
private ILineAliasService lineAliasService; private ISectionStationMapService sectionStationMapService;
@Resource
private ITrainStationService trainStationService;
@AutoLog(value = "线路车站-线别管理-分页列表查询") @AutoLog(value = "线路车站-线别管理-分页列表查询")
@ApiOperation(value = "线路车站-线别管理-分页列表查询", notes = "线路车站-线别管理-分页列表查询") @ApiOperation(value = "线路车站-线别管理-分页列表查询", notes = "线路车站-线别管理-分页列表查询")
...@@ -41,7 +50,7 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS ...@@ -41,7 +50,7 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
LineAliasQueryDTO dto) { LineAliasQueryDTO dto) {
Page<LightAliasQueryVO> pageData = new Page<>(pageNo, pageSize); Page<LightAliasQueryVO> pageData = new Page<>(pageNo, pageSize);
IPage<LightAliasQueryVO> pageList = lineAliasService.queryPageList(pageData, dto); IPage<LightAliasQueryVO> pageList = this.service.queryPageList(pageData, dto);
return Result.OK(pageList); return Result.OK(pageList);
} }
...@@ -58,19 +67,19 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS ...@@ -58,19 +67,19 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS
//获取当前用户 //获取当前用户
if (ObjectUtil.isEmpty(lineAlias.getId())) { if (ObjectUtil.isEmpty(lineAlias.getId())) {
List<LineAlias> list = this.getQueryList(lineAlias.getLineAliasName()); List<LineAlias> list = this.getQueryList(lineAlias.getLineAliasName());
if(list != null && list.size() > 0 ){ if (list != null && list.size() > 0) {
return Result.error("线别名称已存在"); return Result.error("线别名称已存在");
} }
lineAliasService.save(lineAlias); this.service.save(lineAlias);
} else { } else {
LambdaQueryWrapper<LineAlias> lambdaQuery = Wrappers.lambdaQuery(); LambdaQueryWrapper<LineAlias> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.ne(LineAlias::getId,lineAlias.getId()); lambdaQuery.ne(LineAlias::getId, lineAlias.getId());
lambdaQuery.eq(LineAlias::getLineAliasName,lineAlias.getLineAliasName()); lambdaQuery.eq(LineAlias::getLineAliasName, lineAlias.getLineAliasName());
List<LineAlias> list = this.service.list(lambdaQuery); List<LineAlias> list = this.service.list(lambdaQuery);
if(list != null && list.size() > 0 ){ if (list != null && list.size() > 0) {
return Result.error("线别名称已重复"); return Result.error("线别名称已重复");
} }
lineAliasService.updateById(lineAlias); this.service.updateById(lineAlias);
} }
return Result.OK("编辑成功!"); return Result.OK("编辑成功!");
...@@ -78,15 +87,17 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS ...@@ -78,15 +87,17 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS
/** /**
* 查询线别 * 查询线别
*
* @param name * @param name
* @return * @return
*/ */
public List<LineAlias> getQueryList(String name){ public List<LineAlias> getQueryList(String name) {
LambdaQueryWrapper<LineAlias> lambdaQuery = Wrappers.lambdaQuery(); LambdaQueryWrapper<LineAlias> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.eq(LineAlias::getLineAliasName,name); lambdaQuery.eq(LineAlias::getLineAliasName, name);
List<LineAlias> list = this.service.list(lambdaQuery); List<LineAlias> list = this.service.list(lambdaQuery);
return list; return list;
} }
/** /**
* 通过id删除 * 通过id删除
* *
...@@ -97,7 +108,25 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS ...@@ -97,7 +108,25 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS
@ApiOperation(value = "线路车站-线别管理-通过id删除", notes = "线路车站-线别管理-通过id删除") @ApiOperation(value = "线路车站-线别管理-通过id删除", notes = "线路车站-线别管理-通过id删除")
@GetMapping(value = "/delete") @GetMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) { public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
lineAliasService.removeById(id); // 区间线路关联是否都删除了
Long sectionStationMapCount = sectionStationMapService.lambdaQuery()
.eq(SectionStationMap::getStationLineAliasId, id)
.count();
if (sectionStationMapCount > 0) {
throw new JeecgBootException("该线别下面还有关联区间");
}
// 车站关联是否删除
Long trainStationCount = trainStationService.lambdaQuery()
.eq(TrainStation::getLineAliasId, id)
.count();
if (trainStationCount > 0) {
throw new JeecgBootException("该线别下面还有车站");
}
this.service.removeById(id);
this.service.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
...@@ -111,7 +140,24 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS ...@@ -111,7 +140,24 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS
@ApiOperation(value = "线路车站-线别管理-批量删除", notes = "线路车站-线别管理-批量删除") @ApiOperation(value = "线路车站-线别管理-批量删除", notes = "线路车站-线别管理-批量删除")
@GetMapping(value = "/deleteBatch") @GetMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
lineAliasService.removeByIds(Arrays.asList(ids.split(","))); List<String> idList = Arrays.asList(ids.split(","));
for (String id : idList) {
Long sectionStationMapCount = sectionStationMapService.lambdaQuery()
.eq(SectionStationMap::getStationLineAliasId, id)
.count();
if (sectionStationMapCount > 0) {
throw new JeecgBootException("该线别下面还有关联区间");
}
Long trainStationCount = trainStationService.lambdaQuery()
.eq(TrainStation::getLineAliasId, id)
.count();
if (trainStationCount > 0) {
throw new JeecgBootException("该线别下面还有车站");
}
}
this.service.removeByIds(idList);
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
...@@ -119,7 +165,7 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS ...@@ -119,7 +165,7 @@ public class LightAliasController extends JeecgController<LineAlias, ILineAliasS
@ApiOperation(value = "线路车站-线别管理-获取线别管理", notes = "线路车站-线别管理-获取线别管理") @ApiOperation(value = "线路车站-线别管理-获取线别管理", notes = "线路车站-线别管理-获取线别管理")
@GetMapping(value = "/listAll") @GetMapping(value = "/listAll")
public Result<List<Map<String, Object>>> listAll() { public Result<List<Map<String, Object>>> listAll() {
List<LineAlias> records = lineAliasService.list(); List<LineAlias> records = this.service.list();
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
for (LineAlias alias : records) { for (LineAlias alias : records) {
......
...@@ -10,15 +10,22 @@ import lombok.extern.slf4j.Slf4j; ...@@ -10,15 +10,22 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.dto.PageSearch; import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.subwayNetwork.dto.LightRailQueryDTO; import org.jeecg.modules.subwayNetwork.dto.LightRailQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail; import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.SectionStationMap;
import org.jeecg.modules.subwayNetwork.entity.TrainStation;
import org.jeecg.modules.subwayNetwork.service.ILightRailService; import org.jeecg.modules.subwayNetwork.service.ILightRailService;
import org.jeecg.modules.subwayNetwork.service.ISectionStationMapService;
import org.jeecg.modules.subwayNetwork.service.ITrainStationService;
import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO; import org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO; import org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO;
import org.jeecg.modules.subwayNetwork.vo.SectionStationNode; import org.jeecg.modules.subwayNetwork.vo.SectionStationNode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*; import java.util.*;
/** /**
...@@ -33,7 +40,11 @@ import java.util.*; ...@@ -33,7 +40,11 @@ import java.util.*;
@Slf4j @Slf4j
public class LightRailController extends JeecgController<LightRail, ILightRailService> { public class LightRailController extends JeecgController<LightRail, ILightRailService> {
@Resource
private ISectionStationMapService sectionStationMapService;
@Resource
private ITrainStationService trainStationService;
@AutoLog(value = "线路车站-轻轨线路-分页列表查询") @AutoLog(value = "线路车站-轻轨线路-分页列表查询")
@ApiOperation(value = "线路车站-轻轨线路-分页列表查询", notes = "线路车站-轻轨线路-分页列表查询") @ApiOperation(value = "线路车站-轻轨线路-分页列表查询", notes = "线路车站-轻轨线路-分页列表查询")
...@@ -71,9 +82,22 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe ...@@ -71,9 +82,22 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
@ApiOperation(value = "线路车站-轻轨线路-通过id删除", notes = "线路车站-轻轨线路-通过id删除") @ApiOperation(value = "线路车站-轻轨线路-通过id删除", notes = "线路车站-轻轨线路-通过id删除")
@GetMapping(value = "/delete") @GetMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) { public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
this.service.removeById(id); // 区间线路关联是否都删除了
Long sectionStationMapCount = sectionStationMapService.lambdaQuery()
.eq(SectionStationMap::getLightRailId, id)
.count();
if (sectionStationMapCount > 0) {
throw new JeecgBootException("该线路下面还有关联区间");
}
// 车站关联是否删除
Long trainStationCount = trainStationService.lambdaQuery()
.eq(TrainStation::getLightRailId, id)
.count();
if (trainStationCount > 0) {
throw new JeecgBootException("该线路下面还有车站");
}
this.service.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
...@@ -88,7 +112,24 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe ...@@ -88,7 +112,24 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
@ApiOperation(value = "线路车站-轻轨线路-批量删除", notes = "线路车站-轻轨线路-批量删除") @ApiOperation(value = "线路车站-轻轨线路-批量删除", notes = "线路车站-轻轨线路-批量删除")
@GetMapping(value = "/deleteBatch") @GetMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.service.removeByIds(Arrays.asList(ids.split(","))); List<String> idList = Arrays.asList(ids.split(","));
for (String id : idList) {
Long sectionStationMapCount = sectionStationMapService.lambdaQuery()
.eq(SectionStationMap::getLightRailId, id)
.count();
if (sectionStationMapCount > 0) {
throw new JeecgBootException("该线路下面还有关联区间");
}
Long trainStationCount = trainStationService.lambdaQuery()
.eq(TrainStation::getLightRailId, id)
.count();
if (trainStationCount > 0) {
throw new JeecgBootException("该线路下面还有车站");
}
}
this.service.removeByIds(idList);
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
...@@ -114,8 +155,8 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe ...@@ -114,8 +155,8 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
@GetMapping(value = "/listAll") @GetMapping(value = "/listAll")
public Result<List<Map<String, Object>>> listAll() { public Result<List<Map<String, Object>>> listAll() {
LambdaQueryWrapper<LightRail> lambdaQuery = Wrappers.lambdaQuery(); LambdaQueryWrapper<LightRail> lambdaQuery = Wrappers.lambdaQuery();
lambdaQuery.eq(LightRail::getStatus,1); lambdaQuery.eq(LightRail::getStatus, 1);
List<LightRail> pageList =this.service.list(lambdaQuery); List<LightRail> pageList = this.service.list(lambdaQuery);
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
for (LightRail lightRail : pageList) { for (LightRail lightRail : pageList) {
......
...@@ -8,16 +8,20 @@ import lombok.extern.slf4j.Slf4j; ...@@ -8,16 +8,20 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.dto.PageSearch; import org.jeecg.common.api.dto.PageSearch;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.subwayNetwork.dto.TrainStationEditDTO; import org.jeecg.modules.subwayNetwork.dto.TrainStationEditDTO;
import org.jeecg.modules.subwayNetwork.dto.TrainStationQueryDTO; import org.jeecg.modules.subwayNetwork.dto.TrainStationQueryDTO;
import org.jeecg.modules.subwayNetwork.entity.LightRail; import org.jeecg.modules.subwayNetwork.entity.LightRail;
import org.jeecg.modules.subwayNetwork.entity.SectionStationMap;
import org.jeecg.modules.subwayNetwork.entity.TrainStation; import org.jeecg.modules.subwayNetwork.entity.TrainStation;
import org.jeecg.modules.subwayNetwork.service.ISectionStationMapService;
import org.jeecg.modules.subwayNetwork.service.ITrainStationService; import org.jeecg.modules.subwayNetwork.service.ITrainStationService;
import org.jeecg.modules.subwayNetwork.vo.TrainStationVO; import org.jeecg.modules.subwayNetwork.vo.TrainStationVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.*; import java.util.*;
/** /**
...@@ -31,9 +35,12 @@ import java.util.*; ...@@ -31,9 +35,12 @@ import java.util.*;
@RequestMapping("/subwayNetwork/trainStation") @RequestMapping("/subwayNetwork/trainStation")
@Slf4j @Slf4j
public class TrainStationController extends JeecgController<TrainStation, ITrainStationService> { public class TrainStationController extends JeecgController<TrainStation, ITrainStationService> {
@Autowired @Resource
private ITrainStationService trainStationService; private ITrainStationService trainStationService;
@Resource
private ISectionStationMapService sectionStationMapService;
@AutoLog(value = "线路车站-地铁站-分页列表查询") @AutoLog(value = "线路车站-地铁站-分页列表查询")
@ApiOperation(value = "线路车站-地铁站-分页列表查询", notes = "线路车站-地铁站-分页列表查询") @ApiOperation(value = "线路车站-地铁站-分页列表查询", notes = "线路车站-地铁站-分页列表查询")
@PostMapping(value = "/list") @PostMapping(value = "/list")
...@@ -58,6 +65,14 @@ public class TrainStationController extends JeecgController<TrainStation, ITrain ...@@ -58,6 +65,14 @@ public class TrainStationController extends JeecgController<TrainStation, ITrain
@ApiOperation(value = "线路车站-地铁站-通过id删除", notes = "线路车站-地铁站-通过id删除") @ApiOperation(value = "线路车站-地铁站-通过id删除", notes = "线路车站-地铁站-通过id删除")
@GetMapping(value = "/delete") @GetMapping(value = "/delete")
public Result<String> delete(@RequestParam(name = "id", required = true) String id) { public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
// 区间线路关联是否都删除了
Long sectionStationMapCount = sectionStationMapService.lambdaQuery()
.eq(SectionStationMap::getStationId, id)
.count();
if (sectionStationMapCount > 0) {
throw new JeecgBootException("该车站下面还有关联区间");
}
trainStationService.removeById(id); trainStationService.removeById(id);
return Result.OK("删除成功!"); return Result.OK("删除成功!");
} }
...@@ -67,7 +82,18 @@ public class TrainStationController extends JeecgController<TrainStation, ITrain ...@@ -67,7 +82,18 @@ public class TrainStationController extends JeecgController<TrainStation, ITrain
@ApiOperation(value = "线路车站-地铁站-批量删除", notes = "线路车站-地铁站-批量删除") @ApiOperation(value = "线路车站-地铁站-批量删除", notes = "线路车站-地铁站-批量删除")
@GetMapping(value = "/deleteBatch") @GetMapping(value = "/deleteBatch")
public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) { public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
this.trainStationService.removeByIds(Arrays.asList(ids.split(","))); List<String> idList = Arrays.asList(ids.split(","));
for (String id : idList) {
Long sectionStationMapCount = sectionStationMapService.lambdaQuery()
.eq(SectionStationMap::getStationId, id)
.count();
if (sectionStationMapCount > 0) {
throw new JeecgBootException("该车站下面还有关联区间");
}
}
this.service.removeByIds(idList);
return Result.OK("批量删除成功!"); return Result.OK("批量删除成功!");
} }
......
package org.jeecg.modules.subwayNetwork.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.subwayNetwork.entity.SectionStationMap;
/**
* @Description: 线路车站-区间线路关联
* @Author: huangkanglin
* @Date: 2023-06-14
* @Version: V1.0
*/
public interface ISectionStationMapService extends IService<SectionStationMap> {
}
package org.jeecg.modules.subwayNetwork.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.subwayNetwork.entity.SectionStationMap;
import org.jeecg.modules.subwayNetwork.mapper.SectionStationMapMapper;
import org.jeecg.modules.subwayNetwork.service.ISectionStationMapService;
import org.springframework.stereotype.Service;
/**
* @Description: 线路车站-区间线路关联
*/
@Service
public class SectionStationMapServiceImpl extends ServiceImpl<SectionStationMapMapper, SectionStationMap> implements ISectionStationMapService {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment