Commit b6cf3c68 authored by duanruiming's avatar duanruiming

Merge remote-tracking branch 'origin/master'

parents b06b3bc4 6d8bedef
......@@ -12,13 +12,13 @@ import net.wanji.opt.bo.BottomMenuBO;
import net.wanji.opt.bo.MainlineSchemeAnalysisBO;
import net.wanji.opt.service.impl.MainlineEvaluateServiceImpl;
import net.wanji.opt.vo.MainlineEvaluateBottomCurveVO;
import net.wanji.opt.vo.MainlineListVO;
import net.wanji.opt.vo.MainlineSchemeAnalysisVO;
import org.springframework.web.bind.annotation.*;
import javax.ws.rs.core.MediaType;
import java.text.ParseException;
import java.util.List;
import java.util.Set;
@Api(value = "MainlineEvaluateController", description = "干线评价")
@RequestMapping("/mainlineEvaluate")
......@@ -59,7 +59,7 @@ public class MainlineEvaluateController {
@ApiOperation(value = "干线列表", notes = "干线列表")
@GetMapping("/mainlineList")
public JsonViewObject mainlineList() {
Set<String> res = mainlineEvaluateService.mainlineList();
List<MainlineListVO> res = mainlineEvaluateService.mainlineList();
return JsonViewObject.newInstance().success(res);
}
......
......@@ -20,6 +20,7 @@ public class SceneStrategyPO {
/** 策略ID */
@ApiModelProperty(name = "策略ID",notes = "")
private Integer strategyId ;
@ApiModelProperty(name = "优先级",notes = "")
private Integer sceneStrategyPriority ;
/** 创建时间 */
......
......@@ -4,11 +4,11 @@ import net.wanji.opt.bo.BottomCurveBO;
import net.wanji.opt.bo.BottomMenuBO;
import net.wanji.opt.bo.MainlineSchemeAnalysisBO;
import net.wanji.opt.vo.MainlineEvaluateBottomCurveVO;
import net.wanji.opt.vo.MainlineListVO;
import net.wanji.opt.vo.MainlineSchemeAnalysisVO;
import java.text.ParseException;
import java.util.List;
import java.util.Set;
public interface MainlineEvaluateService {
......@@ -16,7 +16,7 @@ public interface MainlineEvaluateService {
List<MainlineEvaluateBottomCurveVO> bottomCurve(BottomCurveBO bo) throws ParseException;
Set<String> mainlineList();
List<MainlineListVO> mainlineList();
MainlineSchemeAnalysisVO mainlineSchemeAnalysis(MainlineSchemeAnalysisBO bo);
}
......@@ -4,17 +4,21 @@ import lombok.extern.slf4j.Slf4j;
import net.wanji.common.enums.BaseEnum;
import net.wanji.common.enums.StrategyAndMetricsEnum;
import net.wanji.common.enums.TurnConvertEnum;
import net.wanji.databus.dao.entity.BaseCrossDirInfoPO;
import net.wanji.databus.dao.entity.GreenwaveHistPO;
import net.wanji.databus.dao.entity.GreenwaveInfoPO;
import net.wanji.databus.dao.entity.*;
import net.wanji.databus.dao.mapper.*;
import net.wanji.databus.po.*;
import net.wanji.databus.vo.CrossIdAndNameVO;
import net.wanji.opt.bo.BottomCurveBO;
import net.wanji.opt.bo.BottomMenuBO;
import net.wanji.opt.bo.MainlineSchemeAnalysisBO;
import net.wanji.opt.dao.mapper.strategy.SceneStrategyMapper;
import net.wanji.opt.dao.mapper.strategy.StrategyMapper;
import net.wanji.opt.dao.mapper.trend.GreenwaveInfoMapper;
import net.wanji.opt.po.strategy.SceneStrategyPO;
import net.wanji.opt.po.strategy.StrategyPO;
import net.wanji.opt.service.MainlineEvaluateService;
import net.wanji.opt.vo.MainlineEvaluateBottomCurveVO;
import net.wanji.opt.vo.MainlineListVO;
import net.wanji.opt.vo.MainlineSchemeAnalysisVO;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
......@@ -40,15 +44,23 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
private final CrossLaneDataHistMapper crossLaneDataHistMapper;
private final GreenwaveInfoMapper greenwaveInfoMapper;
private final GreenwaveHistMapper greenwaveHistMapper;
private final GreenwaveCrossMapper greenwaveCrossMapper;
private final BaseCrossInfoMapper baseCrossInfoMapper;
private final GreenwaveSceneMapper greenwaveSceneMapper;
private final SceneStrategyMapper sceneStrategyMapper;
private final StrategyMapper strategyMapper;
private final BaseCrossSectionMapper baseCrossSectionMapper;
private final RidInfoMapper ridInfoMapper;
SimpleDateFormat hourMinuteFormat = new SimpleDateFormat("HH:mm");
SimpleDateFormat dateHourMinuteFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public MainlineEvaluateServiceImpl(@Qualifier("baseCrossDirInfoMapper") BaseCrossDirInfoMapper baseCrossDirInfoMapper,
@Qualifier("baseCrossTurnInfoMapper") BaseCrossTurnInfoMapper baseCrossTurnInfoMapper,
CrossBaseLaneInfoMapper crossBaseLaneInfoMapper,
@Qualifier("laneInfoMapper") LaneInfoMapper laneInfoMapper,
CrossDirDataHistMapper crossDirDataHistMapper, CrossDataHistMapper crossDataHistMapper, CrossTurnDataHistMapper crossTurnDataHistMapper, CrossLaneDataHistMapper crossLaneDataHistMapper, @Qualifier("greenwaveInfoMapper") GreenwaveInfoMapper greenwaveInfoMapper, @Qualifier("greenwaveHistMapper") GreenwaveHistMapper greenwaveHistMapper) {
CrossDirDataHistMapper crossDirDataHistMapper, CrossDataHistMapper crossDataHistMapper, CrossTurnDataHistMapper crossTurnDataHistMapper, CrossLaneDataHistMapper crossLaneDataHistMapper, @Qualifier("greenwaveInfoMapper") GreenwaveInfoMapper greenwaveInfoMapper, @Qualifier("greenwaveHistMapper") GreenwaveHistMapper greenwaveHistMapper, @Qualifier("greenwaveCrossMapper") GreenwaveCrossMapper greenwaveCrossMapper, @Qualifier("baseCrossInfoMapper") BaseCrossInfoMapper baseCrossInfoMapper, @Qualifier("greenwaveSceneMapper") GreenwaveSceneMapper greenwaveSceneMapper, @Qualifier("sceneStrategyMapper") SceneStrategyMapper sceneStrategyMapper, @Qualifier("strategyMapper") StrategyMapper strategyMapper, @Qualifier("baseCrossSectionMapper") BaseCrossSectionMapper baseCrossSectionMapper, @Qualifier("ridInfoMapper") RidInfoMapper ridInfoMapper) {
this.baseCrossDirInfoMapper = baseCrossDirInfoMapper;
this.baseCrossTurnInfoMapper = baseCrossTurnInfoMapper;
this.laneInfoMapper = laneInfoMapper;
......@@ -58,6 +70,13 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
this.crossLaneDataHistMapper = crossLaneDataHistMapper;
this.greenwaveInfoMapper = greenwaveInfoMapper;
this.greenwaveHistMapper = greenwaveHistMapper;
this.greenwaveCrossMapper = greenwaveCrossMapper;
this.baseCrossInfoMapper = baseCrossInfoMapper;
this.greenwaveSceneMapper = greenwaveSceneMapper;
this.sceneStrategyMapper = sceneStrategyMapper;
this.strategyMapper = strategyMapper;
this.baseCrossSectionMapper = baseCrossSectionMapper;
this.ridInfoMapper = ridInfoMapper;
}
@Override
......@@ -480,33 +499,306 @@ public class MainlineEvaluateServiceImpl implements MainlineEvaluateService {
}
@Override
public Set<String> mainlineList() {
public List<MainlineListVO> mainlineList() {
List<MainlineListVO> res = new ArrayList<>();
// 按干线名称过滤数据
List<GreenwaveInfoPO> poList = greenwaveInfoMapper.selectAll();
Set<String> res = new HashSet<>();
for (GreenwaveInfoPO greenwaveInfoPO : poList) {
String name = greenwaveInfoPO.getName(); // 例:旅游路:转山西路至霞景路路段双向绿波1
String[] split = name.split(":");
res.add(split[0]);
List<GreenwaveInfoPO> filteredList = poList.stream()
.collect(Collectors.groupingBy(po -> getPrefix(po.getName())))
.values()
.stream()
.filter(list -> list.size() > 1)
.map(list -> list.get(0))
.collect(Collectors.toList());
for (GreenwaveInfoPO greenwaveInfoPO : filteredList) {
MainlineListVO mainlineListVO = new MainlineListVO();
String name = greenwaveInfoPO.getName(); // 例:旅游路-转山西路至霞景路路段:双向绿波1
String prefix = getPrefix(name);
mainlineListVO.setMainlineName(prefix);
Integer greenwaveId = greenwaveInfoPO.getId();
setCrossListAndwkt(mainlineListVO, greenwaveId);
res.add(mainlineListVO);
}
return res;
}
private void setCrossListAndwkt(MainlineListVO mainlineListVO, Integer greenwaveId) {
List<GreenwaveCrossPO> greenwaveCrossPOList = greenwaveCrossMapper.selectByGreenwaveId(greenwaveId);
List<CrossIdAndNameVO> crossIdAndNameVOList = new ArrayList<>();
StringBuilder wkt = new StringBuilder();
for (int i = 0; i < greenwaveCrossPOList.size() - 1; i++) {
GreenwaveCrossPO preCross = greenwaveCrossPOList.get(i);
GreenwaveCrossPO nextCross = greenwaveCrossPOList.get(i + 1);
// 构造路口列表
String crossId = preCross.getCrossId();
BaseCrossInfoPO baseCrossInfoPO = baseCrossInfoMapper.selectById(crossId);
CrossIdAndNameVO crossIdAndNameVO = new CrossIdAndNameVO();
crossIdAndNameVO.setCrossId(crossId);
crossIdAndNameVO.setCrossName(baseCrossInfoPO.getName());
crossIdAndNameVOList.add(crossIdAndNameVO);
if (i == greenwaveCrossPOList.size() - 2) {
String crossId1 = nextCross.getCrossId();
BaseCrossInfoPO baseCrossInfoPO1 = baseCrossInfoMapper.selectById(crossId1);
CrossIdAndNameVO crossIdAndNameVO1 = new CrossIdAndNameVO();
crossIdAndNameVO1.setCrossId(crossId1);
crossIdAndNameVO1.setCrossName(baseCrossInfoPO1.getName());
crossIdAndNameVOList.add(crossIdAndNameVO1);
}
// 构造wkt
RidInfoEntity ridInfo = ridInfoMapper.selectByStartEnd(preCross.getCrossId(), nextCross.getCrossId());
if (i == 0) {
wkt.append(ridInfo.getWkt());
} else {
wkt.append(";").append(ridInfo.getWkt());
}
}
mainlineListVO.setCrossList(crossIdAndNameVOList);
mainlineListVO.setWkt(wkt.toString());
}
private String getPrefix(String name) {
int index = name.indexOf(':');
return index != -1 ? name.substring(0, index).trim() : name;
}
@Override
public MainlineSchemeAnalysisVO mainlineSchemeAnalysis(MainlineSchemeAnalysisBO bo) {
String mainlineName = bo.getName();
Date poStartTime = bo.getStartTime();
Date poEndTime = bo.getEndTime();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String poStartTimeStr = sdf.format(poStartTime);
String poEndTimeStr = sdf.format(poEndTime);
// 根据时段查询所有发生的绿波
List<GreenwaveHistPO> greenwaveHistPOList = greenwaveHistMapper
.selectByTimeSection(poStartTimeStr, poEndTimeStr);
// 根据干线名称筛选结果
List<GreenwaveHistPO> filteredList = greenwaveHistPOList.stream()
.filter(po -> {
String name = po.getGreenwaveName();
int index = name.indexOf(':');
if (index != -1) {
String leftSide = name.substring(0, index).trim();
return leftSide.equals(mainlineName);
}
return false;
})
.collect(Collectors.toList());
MainlineSchemeAnalysisVO res = new MainlineSchemeAnalysisVO();
res.setSceneData(calcSceneData(filteredList));
res.setCrossData(calcCrossData(filteredList));
res.setEvaluateData(calcEvaluateData(filteredList));
res.setGreenwaveData(buildGreenwaveData(filteredList));
return res;
}
private List<MainlineSchemeAnalysisVO.GreenwaveData> buildGreenwaveData(List<GreenwaveHistPO> filteredList) {
return null;
}
private List<String> calcEvaluateData(List<GreenwaveHistPO> filteredList) {
int qualified = 0;
int notQualified = 0;
for (GreenwaveHistPO greenwaveHistPO : filteredList) {
Double noparkPassRate = greenwaveHistPO.getNoparkPassRate();
Double cordReliability = greenwaveHistPO.getCordReliability();
Double uncoordinatePhaseQueue = greenwaveHistPO.getUncoordinatePhaseQueue();
Double cordQueueRatio = greenwaveHistPO.getCordQueueRatio();
Integer greenwaveId = greenwaveHistPO.getId();
// 确定控制策略
GreenwaveScenePO greenwaveScenePO = greenwaveSceneMapper.selectByGreenwaveId(greenwaveId);
Integer sceneId = greenwaveScenePO.getSceneId();
List<SceneStrategyPO> sceneStrategyPOList = sceneStrategyMapper.selectBySceneId(sceneId);
Optional<SceneStrategyPO> maxPriorityPO = sceneStrategyPOList.stream()
.max(Comparator.comparingInt(SceneStrategyPO::getSceneStrategyPriority));
SceneStrategyPO sceneStrategyPO = maxPriorityPO.get();
Integer strategyId = sceneStrategyPO.getStrategyId();
StrategyPO strategyPO = strategyMapper.selectById(strategyId);
String strategyCode = strategyPO.getStrategyCode();
// 确定评价
// 获取时段
Integer sectionId = greenwaveHistPO.getSectionId();
CrossSectionPO crossSectionPO = baseCrossSectionMapper.selectById(sectionId);
String startHourMinuteStr = crossSectionPO.getStartTime();
String endHourMinuteStr = crossSectionPO.getEndTime();
Date day = greenwaveHistPO.getGmtModified();
Date startDate = combineDateAndTime(day, startHourMinuteStr);
Date endDate = combineDateAndTime(day, endHourMinuteStr);
// 获取路口
List<BaseCrossInfoPO> crossInfoPOList = getGreenwaveCross(greenwaveId);
// 获取路口历史数据
List<String> crossIdList = crossInfoPOList.stream()
.map(BaseCrossInfoPO::getId)
.collect(Collectors.toList());
int startTimeStamp = (int) (startDate.getTime() / 1000);
int endTimeStamp = (int) (endDate.getTime() / 1000);
List<CrossDataHistPO> crossDataHistPOList = crossDataHistMapper
.selectByCrossIdsAndTimestamp(crossIdList, startTimeStamp, endTimeStamp);
// 判断时段内的饱和度
double saturation = crossDataHistPOList.stream()
.mapToDouble(CrossDataHistPO::getSturation)
.average()
.orElse(0.0);
Integer dir = greenwaveHistPO.getDir();
if (dir == 0 || dir == 1) { // 单向绿波
if (Objects.equals(strategyCode, StrategyAndMetricsEnum.Strategy.LINE_EFFICIENCY.getCode())) {
if (saturation < 0.8) {
if (noparkPassRate > 0.8 && cordReliability > 0.7) {
// 协调不停车通过率需大于80%,并且协调方案可靠性需大于70%
qualified++;
} else if (uncoordinatePhaseQueue < 0.5) {
// 如果以上不满足,则非协调相位二次排队需小于50%
qualified++;
} else {
notQualified++;
}
} else {
// 协调方案可靠性需大于70%
if (cordReliability > 0.7) {
qualified++;
} else {
notQualified++;
}
}
} else if (Objects.equals(strategyCode, StrategyAndMetricsEnum.Strategy.LINE_BALANCE.getCode())) {
if (cordQueueRatio < 0.6) {
// 协调路段排队空间占比需小于60%
qualified++;
} else if (uncoordinatePhaseQueue < 1.0) {
// 如果以上不满足,则非协调相位二次排队需小于100%
qualified ++;
} else {
notQualified++;
}
}
} else { // 双向绿波
if (Objects.equals(strategyCode, StrategyAndMetricsEnum.Strategy.LINE_EFFICIENCY.getCode())) {
// 协调不停车通过率需大于50%,并且协调方案可靠性需大于70%
if (noparkPassRate > 0.5 && cordReliability > 0.7) {
qualified++;
} else {
notQualified++;
}
} else if (Objects.equals(strategyCode, StrategyAndMetricsEnum.Strategy.LINE_BALANCE.getCode())) {
if (cordQueueRatio < 0.6) {
// 协调路段排队空间占比需小于60%
qualified++;
} else if (uncoordinatePhaseQueue < 1.0) {
// 如果以上不满足,则非协调相位二次排队需小于100%
qualified ++;
} else {
notQualified++;
}
}
}
}
List<String> res = new ArrayList<>();
res.add("符合控制策略方案数 " + qualified + "个");
res.add("不符合控制策略方案数 " + notQualified + "个");
return res;
}
private List<BaseCrossInfoPO> getGreenwaveCross(Integer greenwaveId) {
List<BaseCrossInfoPO> res = new ArrayList<>();
List<GreenwaveCrossPO> greenwaveCrosses = greenwaveCrossMapper.selectByGreenwaveId(greenwaveId);
for (GreenwaveCrossPO greenwaveCross : greenwaveCrosses) {
String crossId = greenwaveCross.getCrossId();
BaseCrossInfoPO baseCrossInfoPO = baseCrossInfoMapper.selectById(crossId);
res.add(baseCrossInfoPO);
}
return res;
}
private Date combineDateAndTime(Date day, String hourMinuteStr) {
String[] hourMinute = hourMinuteStr.split(":");
int hour = Integer.parseInt(hourMinute[0]);
int minute = Integer.parseInt(hourMinute[1]);
Calendar calendar = Calendar.getInstance();
calendar.setTime(day);
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minute);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
}
private List<MainlineSchemeAnalysisVO.CrossData> calcCrossData(List<GreenwaveHistPO> filteredList) {
List<MainlineSchemeAnalysisVO.CrossData> res = new ArrayList<>();
// 找出绿波对应的关键路口
Map<Integer, String> greenwaveCrossMap = new HashMap<>();
for (GreenwaveHistPO greenwaveHistPO : filteredList) {
Integer greenwaveId = greenwaveHistPO.getId();
GreenwaveCrossPO greenwaveCrossPO = greenwaveCrossMapper.selectByGreenwaveIdAndKeyRoute(greenwaveId);
Integer greenId = greenwaveCrossPO.getGreenId();
String crossId = greenwaveCrossPO.getCrossId();
greenwaveCrossMap.put(greenId, crossId);
}
// 统计关键路口次数
Map<String, Integer> crossTimesMap = new HashMap<>();
for (GreenwaveHistPO greenwaveHistPO : filteredList) {
Integer greenwaveHistPOId = greenwaveHistPO.getId();
String crossId = greenwaveCrossMap.get(greenwaveHistPOId);
crossTimesMap.put(crossId, crossTimesMap.getOrDefault(crossId, 0) + 1);
}
for (Map.Entry<String, Integer> entry : crossTimesMap.entrySet()) {
MainlineSchemeAnalysisVO.CrossData crossData = new MainlineSchemeAnalysisVO.CrossData();
String crossId = entry.getKey();
BaseCrossInfoPO baseCrossInfoPO = baseCrossInfoMapper.selectById(crossId);
String crossName = baseCrossInfoPO.getName();
crossData.setName(crossName);
crossData.setTimes(entry.getValue());
res.add(crossData);
}
return res;
}
private List<MainlineSchemeAnalysisVO.DirectionData> calcSceneData(List<GreenwaveHistPO> filteredList) {
List<MainlineSchemeAnalysisVO.DirectionData> res = new ArrayList<>();
HashMap<String, Integer> map = new HashMap<>();
for (GreenwaveHistPO greenwaveHistPO : filteredList) {
Integer dir = greenwaveHistPO.getDir();
if (dir == 0) { // 正向
map.put("单向绿波上行", map.getOrDefault("单向绿波上行", 0) + 1);
} else if (dir == 1) { // 反向
map.put("单向绿波下行", map.getOrDefault("单向绿波下行", 0) + 1);
} else { // 双向
map.put("双向绿波", map.getOrDefault("双向绿波", 0) + 1);
}
}
for (Map.Entry<String, Integer> entry : map.entrySet()) {
MainlineSchemeAnalysisVO.DirectionData directionData = new MainlineSchemeAnalysisVO.DirectionData();
directionData.setName(entry.getKey());
directionData.setTimes(entry.getValue());
res.add(directionData);
}
return res;
}
private Date calcDate(String timeStr, Date startTime) throws ParseException {
// 使用 Calendar 来获取年、月、日信息
Calendar calendar = Calendar.getInstance();
......
package net.wanji.opt.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.wanji.databus.vo.CrossIdAndNameVO;
import java.util.List;
/**
* @author Kent HAN
* @date 2023/2/9 8:38
*/
@Data
@NoArgsConstructor
@ApiModel(value = "MainlineListVO", description = "干线列表")
public class MainlineListVO {
@ApiModelProperty(value = "干线名称")
private String mainlineName;
@ApiModelProperty(value = "路口列表")
private List<CrossIdAndNameVO> crossList;
@ApiModelProperty(value = "干线坐标")
private String wkt;
}
......@@ -9,7 +9,9 @@ public class StrategyAndMetricsEnum {
public enum Strategy {
BALANCE("100030", "均衡调控"),
EFFICIENCY("100152", "效率提升"),
SECURITY("100010", "安全保障");
SECURITY("100010", "安全保障"),
LINE_EFFICIENCY("200001", "干线效率提升"),
LINE_BALANCE("200002", "干线均衡调控");
private final String code;
private final String msg;
......
......@@ -10,6 +10,12 @@ import lombok.Data;
@Data
public class GreenwaveHistPO extends GreenwaveRealtimePO{
@ApiModelProperty(value = "绿波名称",notes = "")
private String greenwaveName ;
@ApiModelProperty(value = "绿波名称")
private String greenwaveName;
@ApiModelProperty(value = "协调方向:0正向;1反向;2双向")
private Integer dir;
@ApiModelProperty(value = "时段ID")
private Integer sectionId;
}
......@@ -28,4 +28,6 @@ public interface CrossDataHistMapper extends BaseMapper<CrossDataHistPO> {
Double selectMaxSaturation(String crossId, int startStamp, int endStamp);
Integer selectCrossEmergencyCount(String crossId, int startStamp, int endStamp);
List<CrossDataHistPO> selectByCrossIdsAndTimestamp(List<String> crossIdList, int startTimeStamp, int endTimeStamp);
}
......@@ -12,4 +12,6 @@ import java.util.List;
@Repository
public interface GreenwaveCrossMapper {
List<GreenwaveCrossPO> selectByGreenwaveId(Integer id);
GreenwaveCrossPO selectByGreenwaveIdAndKeyRoute(Integer greenwaveId);
}
......@@ -12,4 +12,6 @@ public interface GreenwaveSceneMapper {
void deleteByGreenwaveId(Integer greenwaveId);
void insertOne(GreenwaveScenePO greenwaveScenePO);
GreenwaveScenePO selectByGreenwaveId(Integer greenwaveId);
}
......@@ -112,4 +112,16 @@
AND cross_id = #{crossId}
</select>
<select id="selectByCrossIdsAndTimestamp" resultType="net.wanji.databus.po.CrossDataHistPO">
select <include refid="Base_Column_List"></include>
from t_cross_data_hist
where cross_id in
<foreach collection="crossIdList" item="crossId" separator="," open="(" close=")">
#{crossId}
</foreach>
and batch_time <![CDATA[ >= ]]> #{startTimeStamp}
and batch_time <![CDATA[ <= ]]> #{endTimeStamp}
order by batch_time
</select>
</mapper>
\ No newline at end of file
......@@ -2,13 +2,22 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.databus.dao.mapper.GreenwaveCrossMapper">
<sql id="Base_Column_List">
id,green_id,cross_id,in_dir,out_dir,offset,sort,section_id,next_cross_len,is_key_route,gmt_create,gmt_modified
</sql>
<select id="selectByGreenwaveId" resultType="net.wanji.databus.dao.entity.GreenwaveCrossPO">
select
id,green_id,cross_id,in_dir,out_dir,offset,sort,section_id,next_cross_len,is_key_route,gmt_create,gmt_modified
select <include refid="Base_Column_List"/>
from t_greenwave_cross
where green_id = #{id}
order by sort
</select>
<select id="selectByGreenwaveIdAndKeyRoute" resultType="net.wanji.databus.dao.entity.GreenwaveCrossPO">
select <include refid="Base_Column_List"/>
from t_greenwave_cross
where green_id = #{id} and is_key_route = 1
</select>
</mapper>
......@@ -27,7 +27,7 @@
<select id="selectByTimeSection" resultType="net.wanji.databus.dao.entity.GreenwaveHistPO">
select t1.id,t1.status,t1.type,t1.traffic_index,t1.speed,t1.trval_time,t1.stop_times,t1.queue_length,
t1.cong_rate,t1.delay_time,t1.nopark_pass_rate,t1.cord_reliability,t1.cord_queue_ratio,
t1.uncoordinate_phase_queue,t1.gmt_create,t1.gmt_modified, t2.name as greenwaveName
t1.uncoordinate_phase_queue,t1.gmt_create,t1.gmt_modified, t2.name as greenwaveName, t2.dir, t2.section_id
from t_greenwave_hist t1 join t_greenwave_info t2 on t1.id = t2.id
where t1.gmt_modified <![CDATA[ <= ]]> #{endTimeStr}
and t1.gmt_modified <![CDATA[ >= ]]> #{startTimeStr}
......
......@@ -2,6 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.wanji.databus.dao.mapper.GreenwaveSceneMapper">
<sql id="Base_Column_List">
id,greenwave_id,scene_id,gmt_create,gmt_modified
</sql>
<insert id="insertOne">
insert into t_greenwave_scene(greenwave_id,scene_id)
......@@ -10,7 +13,13 @@
<delete id="deleteByGreenwaveId">
delete from t_greenwave_scene
where greenwave_id = ${greenwaveId}
where greenwave_id = #{greenwaveId}
</delete>
<select id="selectByGreenwaveId" resultType="net.wanji.databus.po.GreenwaveScenePO">
select <include refid="Base_Column_List"/>
from t_greenwave_scene
where greenwave_id = #{greenwaveId}
</select>
</mapper>
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