Commit 82f74dc6 authored by duanruiming's avatar duanruiming

[update] 优化代码

parent e3ca6c44
...@@ -21,6 +21,7 @@ import net.wanji.web.po.scheme.CrossDirInfoPO; ...@@ -21,6 +21,7 @@ import net.wanji.web.po.scheme.CrossDirInfoPO;
import net.wanji.web.service.scheme.CrossConfigService; import net.wanji.web.service.scheme.CrossConfigService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -101,6 +102,7 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -101,6 +102,7 @@ public class CrossConfigServiceImpl implements CrossConfigService {
for (DirListElement dirListElement : dirList) { for (DirListElement dirListElement : dirList) {
List<LaneListElement> laneList = dirListElement.getLaneList(); List<LaneListElement> laneList = dirListElement.getLaneList();
Integer dir = dirListElement.getDir(); Integer dir = dirListElement.getDir();
if (!CollectionUtils.isEmpty(laneList)) {
for (LaneListElement laneListElement : laneList) { for (LaneListElement laneListElement : laneList) {
// 根据路口ID、方向、车道代码获取车道ID // 根据路口ID、方向、车道代码获取车道ID
String code = laneListElement.getName(); // 车道代码 String code = laneListElement.getName(); // 车道代码
...@@ -121,6 +123,7 @@ public class CrossConfigServiceImpl implements CrossConfigService { ...@@ -121,6 +123,7 @@ public class CrossConfigServiceImpl implements CrossConfigService {
crossLaneLightsPOList.add(crossLaneLightsPO); crossLaneLightsPOList.add(crossLaneLightsPO);
} }
} }
}
baseCrossLaneLightsMapper.deleteByCrossId(crossId); baseCrossLaneLightsMapper.deleteByCrossId(crossId);
baseCrossLaneLightsMapper.insertBatch(crossLaneLightsPOList); baseCrossLaneLightsMapper.insertBatch(crossLaneLightsPOList);
} }
......
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