Commit 5f2bd8be authored by hkl's avatar hkl

feat:1.代码提交

parent 6069faab
......@@ -16,4 +16,5 @@ import org.jeecg.modules.subwayNetwork.vo.TrainStationVO;
public interface TrainStationMapper extends BaseMapper<TrainStation> {
IPage<TrainStationVO> queryPageList(IPage<LightRailQueryVO> page, TrainStationQueryDTO query);
}
......@@ -60,7 +60,7 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
// 车站数量
int trainStationNum = endTrainStation.getSeq() - startTrainStation.getSeq();
int trainStationNum = endTrainStation.getSeq() - startTrainStation.getSeq() + 1;
record.setTrainStationNum(trainStationNum);
}
......
......@@ -18,6 +18,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.math.BigDecimal;
import java.util.List;
/**
* @Description: 线路车站-地铁站
......@@ -36,26 +37,38 @@ public class TrainStationServiceImpl extends ServiceImpl<TrainStationMapper, Tra
@Override
public void edit(TrainStationEditDTO dto) {
// 1.计算当前线路下面有多少个站台
Long count = this.lambdaQuery()
.eq(TrainStation::getLightRailId, dto.getLightRailId())
.count();
// 2.计算站长度:终点里程-起始里程
// 1.计算站长度:终点里程-起始里程
BigDecimal length = dto.getEndMileage().subtract(dto.getStartingMileage());
// 3.通过id判断是保存还是修改
// 2.通过id判断是保存还是修改
if (ObjectUtil.isEmpty(dto.getId())) {
//
Integer seq = 1;
TrainStation exist = this.lambdaQuery().eq(TrainStation::getLightRailId, dto.getLightRailId())
.eq(TrainStation::getStationName, dto.getStationName())
.last("limit 1")
.one();
if (ObjectUtil.isEmpty(exist)) {
List<TrainStation> list = this.lambdaQuery()
.eq(TrainStation::getLightRailId, dto.getLightRailId())
.groupBy(TrainStation::getStationName)
.list();
seq = list.size() + 1;
} else {
seq = exist.getSeq();
}
TrainStation trainStation = BeanUtil.copyProperties(dto, TrainStation.class);
trainStation.setLength(length);
trainStation.setSeq(count.intValue() + 1);
trainStation.setSeq(seq);
this.save(trainStation);
} else {
TrainStation trainStation = BeanUtil.copyProperties(dto, TrainStation.class);
trainStation.setLength(length);
trainStation.setSeq(count.intValue() + 1);
this.updateById(trainStation);
}
}
}
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