Commit e40f4d0c authored by duwei's avatar duwei

优化交通指标4个指标统计

parent dbf5d81c
...@@ -278,7 +278,7 @@ public class TrendController { ...@@ -278,7 +278,7 @@ public class TrendController {
} }
/** /**
* 交通指标 - 车道级 * 交通指标 - 车道级数据
* @param crossIdDateTimeVO * @param crossIdDateTimeVO
* @return * @return
* @throws Exception * @throws Exception
...@@ -290,18 +290,18 @@ public class TrendController { ...@@ -290,18 +290,18 @@ public class TrendController {
@ApiResponses({ @ApiResponses({
@ApiResponse(code = 200, message = "OK", response = TableQueryVO.CycleDataElement.class), @ApiResponse(code = 200, message = "OK", response = TableQueryVO.CycleDataElement.class),
}) })
public JsonViewObject laneTrafficIndex(@RequestBody CommonCrossIdDateTimeVO crossIdDateTimeVO) throws Exception { public JsonViewObject laneTrafficIndex(@RequestBody LanePeriodVO crossIdDateTimeVO) throws Exception {
List<TableQueryVO.CycleDataElement> result = trendService.laneTrafficIndex(crossIdDateTimeVO); List<TableQueryVO.CycleDataElement> result = trendService.laneTrafficIndex(crossIdDateTimeVO);
return JsonViewObject.newInstance().success(result); return JsonViewObject.newInstance().success(result);
} }
/** /**
* 车道交通指标 - 转向级数据 * 交通指标 - 转向级数据
* @param lanePeriodTurnVO * @param lanePeriodTurnVO
* @return * @return
* @throws Exception * @throws Exception
*/ */
@ApiOperation(value = "车道周期转向数据", notes = "车道周期转向数据", response = JsonViewObject.class, @ApiOperation(value = "转向级交通指标", notes = "转向级交通指标", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/lanePeriodTurnData", @PostMapping(value = "/lanePeriodTurnData",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
...@@ -329,7 +329,7 @@ public class TrendController { ...@@ -329,7 +329,7 @@ public class TrendController {
* @return * @return
* @throws Exception * @throws Exception
*/ */
@ApiOperation(value = "路口方向级数据", notes = "路口方向级数据", response = JsonViewObject.class, @ApiOperation(value = "方向级交通指标", notes = "方向级交通指标", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/periodDirectionData", @PostMapping(value = "/periodDirectionData",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
...@@ -354,7 +354,7 @@ public class TrendController { ...@@ -354,7 +354,7 @@ public class TrendController {
* @return * @return
* @throws Exception * @throws Exception
*/ */
@ApiOperation(value = "路口级数据", notes = "路口级数据", response = JsonViewObject.class, @ApiOperation(value = "路口级交通指标", notes = "路口级交通指标", response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/periodCrossingData", @PostMapping(value = "/periodCrossingData",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON) produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
......
...@@ -60,7 +60,7 @@ public interface TrendService { ...@@ -60,7 +60,7 @@ public interface TrendService {
CrossStatusTimeRateVO crossStatusTimeRate(CommonCrossIdVO commonCrossIdVO) throws Exception; CrossStatusTimeRateVO crossStatusTimeRate(CommonCrossIdVO commonCrossIdVO) throws Exception;
List<TableQueryVO.CycleDataElement> laneTrafficIndex(CommonCrossIdDateTimeVO crossIdDateTimeVO) throws Exception; List<TableQueryVO.CycleDataElement> laneTrafficIndex(LanePeriodVO lanePeriodVO) throws Exception;
List<TableQueryVO.RealTimeDataElement> laneSnapshotIndex(LaneSnapshotIndexVO laneSnapshotIndexVO) throws Exception; List<TableQueryVO.RealTimeDataElement> laneSnapshotIndex(LaneSnapshotIndexVO laneSnapshotIndexVO) throws Exception;
List<OverflowEvent> overFlowEvent(LaneSnapshotIndexVO laneSnapshotIndexVO) throws Exception; List<OverflowEvent> overFlowEvent(LaneSnapshotIndexVO laneSnapshotIndexVO) throws Exception;
......
...@@ -1642,7 +1642,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -1642,7 +1642,7 @@ public class TrendServiceImpl implements TrendService {
private List<CrossingTurnQueryVO.CycleDataElement> buildCrossingTurnCycleData(String crossId, List<CrossTurnDataHistVO> vos) { private List<CrossingTurnQueryVO.CycleDataElement> buildCrossingTurnCycleData(String crossId, List<CrossTurnDataHistVO> vos) {
List<CrossingTurnQueryVO.CycleDataElement> res = new ArrayList<>(); List<CrossingTurnQueryVO.CycleDataElement> res = new ArrayList<>();
int pedFlow = 0; // int pedFlow = 0;
for (CrossTurnDataHistVO po : vos) { for (CrossTurnDataHistVO po : vos) {
CrossingTurnQueryVO.CycleDataElement vo = new CrossingTurnQueryVO.CycleDataElement(); CrossingTurnQueryVO.CycleDataElement vo = new CrossingTurnQueryVO.CycleDataElement();
if (po.getStartTime() == null || po.getStartTime().equals("0000")){ if (po.getStartTime() == null || po.getStartTime().equals("0000")){
...@@ -1654,7 +1654,12 @@ public class TrendServiceImpl implements TrendService { ...@@ -1654,7 +1654,12 @@ public class TrendServiceImpl implements TrendService {
vo.setTurnType(po.getTurnType()); vo.setTurnType(po.getTurnType());
vo.setTurnTypeName(TurnConvertEnum.getDescByCode(po.getTurnType())); vo.setTurnTypeName(TurnConvertEnum.getDescByCode(po.getTurnType()));
vo.setFlow(po.getFlow()); vo.setFlow(po.getFlow());
vo.setPedFlow(pedFlow); //参照(行人流量 + 非机动车流量 + 交通流量)
// vo.setAllFlow(pedFlow + po.getNonMotorFlow() + po.getFlow());
//vo.setAllVehiceleFlow(po.getFlow() + po.getNonMotorFlow());
vo.setAllVehiceleFlow(po.getFlow() + 0);//车辆总和
vo.setAllFlow(0 + 0 + po.getFlow());
vo.setPedFlow(0);
vo.setNonMotorFlow(0);//非机动车流量 vo.setNonMotorFlow(0);//非机动车流量
vo.setTrafficFlowA( po.getTrafficFlowA()); vo.setTrafficFlowA( po.getTrafficFlowA());
vo.setTrafficFlowB( po.getTrafficFlowB()); vo.setTrafficFlowB( po.getTrafficFlowB());
...@@ -1743,7 +1748,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -1743,7 +1748,7 @@ public class TrendServiceImpl implements TrendService {
vo.setPedCrossRedLightRate(0.0); vo.setPedCrossRedLightRate(0.0);
// vo.setV85(Math.round(po.getV85() * 100) / 100); // vo.setV85(Math.round(po.getV85() * 100) / 100);
// vo.setAllFlow(pedFlow + po.getNonMotorFlow() + po.getFlow()); //
// vo.setAllVehiceleFlow(po.getFlow() + po.getNonMotorFlow()); // vo.setAllVehiceleFlow(po.getFlow() + po.getNonMotorFlow());
// vo.setTurn(po.getTurn()); // vo.setTurn(po.getTurn());
...@@ -1768,15 +1773,20 @@ public class TrendServiceImpl implements TrendService { ...@@ -1768,15 +1773,20 @@ public class TrendServiceImpl implements TrendService {
private List<CrossingDirectionQueryVO.CycleDataElement> buildCrossingDirectionCycleData(String crossId, List<CrossDirDataHistVO> vos) { private List<CrossingDirectionQueryVO.CycleDataElement> buildCrossingDirectionCycleData(String crossId, List<CrossDirDataHistVO> vos) {
List<CrossingDirectionQueryVO.CycleDataElement> res = new ArrayList<>(); List<CrossingDirectionQueryVO.CycleDataElement> res = new ArrayList<>();
int pedFlow = 0; // int pedFlow = 0;
for (CrossDirDataHistVO po : vos) { for (CrossDirDataHistVO po : vos) {
CrossingDirectionQueryVO.CycleDataElement vo = new CrossingDirectionQueryVO.CycleDataElement(); CrossingDirectionQueryVO.CycleDataElement vo = new CrossingDirectionQueryVO.CycleDataElement();
vo.setTime(po.getStartTime()); vo.setTime(po.getStartTime());
vo.setDir(po.getDirType()); vo.setDir(po.getDirType());
vo.setDirName(BaseEnum.SignalDirectionEnum.getNameByCode(po.getDirType())); vo.setDirName(BaseEnum.SignalDirectionEnum.getNameByCode(po.getDirType()));
vo.setFlow(po.getFlow()); vo.setFlow(po.getFlow());//流量
vo.setPedFlow(pedFlow); //参照(行人流量 + 非机动车流量 + 交通流量)
// vo.setAllFlow(pedFlow + po.getNonMotorFlow() + po.getFlow());
vo.setAllFlow(0 + 0 + po.getFlow());//总流量
//vo.setAllVehiceleFlow(po.getFlow() + po.getNonMotorFlow());
vo.setAllVehiceleFlow(po.getFlow() + 0);//车辆总和
vo.setPedFlow(0);
vo.setNonMotorFlow(0);//非机动车流量 vo.setNonMotorFlow(0);//非机动车流量
vo.setTrafficFlowA((int) po.getTrafficFlowA()); vo.setTrafficFlowA((int) po.getTrafficFlowA());
vo.setTrafficFlowB((int) po.getTrafficFlowB()); vo.setTrafficFlowB((int) po.getTrafficFlowB());
...@@ -1869,7 +1879,7 @@ public class TrendServiceImpl implements TrendService { ...@@ -1869,7 +1879,7 @@ public class TrendServiceImpl implements TrendService {
// vo.setV85(Math.round(po.getV85() * 100) / 100); // vo.setV85(Math.round(po.getV85() * 100) / 100);
// vo.setAllFlow(pedFlow + po.getNonMotorFlow() + po.getFlow()); // vo.setAllFlow(pedFlow + po.getNonMotorFlow() + po.getFlow());
// vo.setAllVehiceleFlow(po.getFlow() + po.getNonMotorFlow()); //
// vo.setTurn(0); // vo.setTurn(0);
// String dirName = BaseEnum.SignalDirectionEnum.getNameByCode(po.getDir()); // String dirName = BaseEnum.SignalDirectionEnum.getNameByCode(po.getDir());
...@@ -1894,12 +1904,15 @@ public class TrendServiceImpl implements TrendService { ...@@ -1894,12 +1904,15 @@ public class TrendServiceImpl implements TrendService {
private List<CrossingQueryVO.CycleDataElement> buildCrossingCycleData(String crossId, List<CrossDataHistVO> poExtList) { private List<CrossingQueryVO.CycleDataElement> buildCrossingCycleData(String crossId, List<CrossDataHistVO> poExtList) {
List<CrossingQueryVO.CycleDataElement> res = new ArrayList<>(); List<CrossingQueryVO.CycleDataElement> res = new ArrayList<>();
int pedFlow = 0; // int pedFlow = 0;
for (CrossDataHistVO po : poExtList) { for (CrossDataHistVO po : poExtList) {
CrossingQueryVO.CycleDataElement vo = new CrossingQueryVO.CycleDataElement(); CrossingQueryVO.CycleDataElement vo = new CrossingQueryVO.CycleDataElement();
vo.setTime(po.getStartTime()); vo.setTime(po.getStartTime());
vo.setFlow(po.getFlow()); vo.setFlow(po.getFlow());
vo.setPedFlow(pedFlow); //行人流量 + 非机动车流量 + 流量
vo.setAllFlow(0 + po.getNonMotorFlow() + po.getFlow());
vo.setAllVehiceleFlow(po.getFlow() + po.getNonMotorFlow());
vo.setPedFlow(0);
vo.setNonMotorFlow(0);//非机动车流量 vo.setNonMotorFlow(0);//非机动车流量
vo.setTrafficFlowA( po.getTrafficFlowA()); vo.setTrafficFlowA( po.getTrafficFlowA());
vo.setTrafficFlowB( po.getTrafficFlowB()); vo.setTrafficFlowB( po.getTrafficFlowB());
...@@ -1991,14 +2004,9 @@ public class TrendServiceImpl implements TrendService { ...@@ -1991,14 +2004,9 @@ public class TrendServiceImpl implements TrendService {
vo.setPedCrossRedLightRate(0.0); vo.setPedCrossRedLightRate(0.0);
// vo.setVehheadDist(po.getVehheadDist()); // vo.setVehheadDist(po.getVehheadDist());
// vo.setTrafficFlowA(po.getTrafficFlowA());
// vo.setTrafficFlowB(po.getTrafficFlowB());
// vo.setTrafficFlowC(po.getTrafficFlowC());
vo.setNonMotorFlow(po.getNonMotorFlow()); vo.setNonMotorFlow(po.getNonMotorFlow());
vo.setV85(Math.round(po.getV85() * 100) / 100); vo.setV85(Math.round(po.getV85() * 100) / 100);
vo.setPedFlow(pedFlow);
vo.setAllFlow(pedFlow + po.getNonMotorFlow() + po.getFlow());
vo.setAllVehiceleFlow(po.getFlow() + po.getNonMotorFlow());
// vo.setTurn(po.getTurn()); // vo.setTurn(po.getTurn());
res.add(vo); res.add(vo);
...@@ -2520,28 +2528,28 @@ public class TrendServiceImpl implements TrendService { ...@@ -2520,28 +2528,28 @@ public class TrendServiceImpl implements TrendService {
/** /**
* 车道级数据查询 * 车道级数据查询
* @param crossIdDateTimeVO * @param lanePeriodVO
* @return * @return
* @throws Exception * @throws Exception
*/ */
@Override @Override
public List<TableQueryVO.CycleDataElement> laneTrafficIndex(CommonCrossIdDateTimeVO crossIdDateTimeVO) throws Exception { public List<TableQueryVO.CycleDataElement> laneTrafficIndex(LanePeriodVO lanePeriodVO) throws Exception {
try { try {
String crossId = crossIdDateTimeVO.getCrossId(); String crossId = lanePeriodVO.getCrossId();
int start = (int) (crossIdDateTimeVO.getStart().getTime() / 1000); int start = (int) (lanePeriodVO.getStart().getTime() / 1000);
int end = (int) (crossIdDateTimeVO.getEnd().getTime() / 1000); int end = (int) (lanePeriodVO.getEnd().getTime() / 1000);
String ids = crossIdDateTimeVO.getIds(); String ids = lanePeriodVO.getIds();
List<String> idsList = null; List<String> idsList = null;
if (!StringUtils.isBlank(ids)) { if (!StringUtils.isBlank(ids)) {
idsList = Arrays.asList(ids.split(",")); idsList = Arrays.asList(ids.split(","));
} }
//分析粒度【5m:五分钟 10m:10分钟 30m:30分钟 1h:一小时】 //分析粒度【5m:五分钟 10m:10分钟 30m:30分钟 1h:一小时】
String granularity = crossIdDateTimeVO.getGranularity(); String granularity = lanePeriodVO.getGranularity();
if (StringUtils.isBlank(granularity)) { if (StringUtils.isBlank(granularity)) {
granularity = "5"; granularity = "5";
}else { }else {
granularity = granularity.replace("m", "").replace("h", "");; granularity = granularity.replace("m", "").replace("h", "");
} }
// 查询周期数据 // 查询周期数据
......
...@@ -23,9 +23,6 @@ public class CommonCrossIdDateTimeVO { ...@@ -23,9 +23,6 @@ public class CommonCrossIdDateTimeVO {
@ApiModelProperty(value = "路口ID") @ApiModelProperty(value = "路口ID")
@NotBlank(message = "路口编号不能为空") @NotBlank(message = "路口编号不能为空")
private String crossId; private String crossId;
@ApiModelProperty(value = "车道IDs")
@NotBlank(message = "车道ids不能为空")
private String ids;
@ApiModelProperty(value = "开始时间") @ApiModelProperty(value = "开始时间")
@NotNull(message = "开始日期不能为空") @NotNull(message = "开始日期不能为空")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
......
...@@ -37,9 +37,9 @@ public class CrossingDirectionQueryVO { ...@@ -37,9 +37,9 @@ public class CrossingDirectionQueryVO {
@ExcelProperty("方向名称") @ExcelProperty("方向名称")
private String dirName; private String dirName;
// @ApiModelProperty(value = "总流量") @ApiModelProperty(value = "总流量")
// @ExcelProperty("总流量") @ExcelProperty("总流量")
// private int allFlow; private int allFlow;
@ApiModelProperty(value = "行人流量") @ApiModelProperty(value = "行人流量")
@ExcelProperty("行人流量") @ExcelProperty("行人流量")
...@@ -207,8 +207,8 @@ public class CrossingDirectionQueryVO { ...@@ -207,8 +207,8 @@ public class CrossingDirectionQueryVO {
@ExcelProperty("行人闯红灯率") @ExcelProperty("行人闯红灯率")
private double pedCrossRedLightRate; private double pedCrossRedLightRate;
// @ApiModelProperty(value = "车辆总和") @ApiModelProperty(value = "车辆总和")
// @ExcelProperty("车辆总和") @ExcelProperty("车辆总和")
// private int allVehiceleFlow; private int allVehiceleFlow;
} }
} }
...@@ -49,9 +49,9 @@ public class CrossingTurnQueryVO { ...@@ -49,9 +49,9 @@ public class CrossingTurnQueryVO {
@ExcelProperty("转向类型名称") @ExcelProperty("转向类型名称")
private String turnTypeName; private String turnTypeName;
// @ApiModelProperty(value = "总流量") @ApiModelProperty(value = "总流量")
// @ExcelProperty("总流量") @ExcelProperty("总流量")
// private int allFlow; private int allFlow;
@ApiModelProperty(value = "行人流量") @ApiModelProperty(value = "行人流量")
@ExcelProperty("行人流量") @ExcelProperty("行人流量")
...@@ -219,8 +219,8 @@ public class CrossingTurnQueryVO { ...@@ -219,8 +219,8 @@ public class CrossingTurnQueryVO {
@ExcelProperty("行人闯红灯率") @ExcelProperty("行人闯红灯率")
private double pedCrossRedLightRate; private double pedCrossRedLightRate;
// @ApiModelProperty(value = "车辆总和") @ApiModelProperty(value = "车辆总和")
// @ExcelProperty("车辆总和") @ExcelProperty("车辆总和")
// private int allVehiceleFlow; private int allVehiceleFlow;
} }
} }
package net.wanji.opt.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
/**
* @author duanruiming
* @date 2024/05/17 9:00
*/
@Data
@NoArgsConstructor
@ApiModel(value = "LanePeriodVO")
public class LanePeriodVO extends CommonCrossIdDateTimeVO {
@ApiModelProperty(value = "分析粒度【5m:五分钟 10m:10分钟 30m:30分钟 1h:一小时】")
private String granularity;
@ApiModelProperty(value = "车道IDs")
@NotBlank(message = "车道ids不能为空")
private String ids;
}
...@@ -118,7 +118,7 @@ public class TableQueryVO { ...@@ -118,7 +118,7 @@ public class TableQueryVO {
@ExcelIgnore @ExcelIgnore
private Integer dir; private Integer dir;
@ExcelProperty("方向") @ExcelProperty("方向名称")
private String dirName; private String dirName;
@ApiModelProperty(value = "车道转向:1左转;2直行;3右转;4掉头;5直左;6直右;7左直右;8左右;9左转掉头;10直行掉头;11右转掉头;12左直掉头;13直右掉头;14左直右掉头;15左右掉头',\n") @ApiModelProperty(value = "车道转向:1左转;2直行;3右转;4掉头;5直左;6直右;7左直右;8左右;9左转掉头;10直行掉头;11右转掉头;12左直掉头;13直右掉头;14左直右掉头;15左右掉头',\n")
......
...@@ -98,40 +98,41 @@ ...@@ -98,40 +98,41 @@
<!-- 交通指标-路口级统计 --> <!-- 交通指标-路口级统计 -->
<select id="selectByCrossIdAndStartEndStat" resultType="net.wanji.databus.vo.CrossDataHistVO"> <select id="selectByCrossIdAndStartEndStat" resultType="net.wanji.databus.vo.CrossDataHistVO">
SELECT SELECT
cross_id AS crossId, t2.cross_id AS crossId,
<choose> <choose>
<!-- 小时 --> <!-- 小时 -->
<when test="granularity==1"> <when test="granularity==1">
DATE_FORMAT(start_time, '%Y-%m-%d %H:00:00') AS startTime, DATE_FORMAT(t2.start_time, '%Y-%m-%d %H:00:00') AS startTime,
</when> </when>
<!-- 分钟 --> <!-- 分钟 -->
<otherwise> <otherwise>
DATE_FORMAT( DATE_FORMAT(
CONCAT( DATE ( start_time ), ' ', HOUR ( start_time ), ':', FLOOR( MINUTE ( start_time ) / #{granularity} ) * #{granularity} ), CONCAT( DATE ( t2.start_time ), ' ', HOUR ( t2.start_time ), ':', FLOOR( MINUTE ( t2.start_time ) / #{granularity} ) * #{granularity} ),
'%Y-%m-%d %H:%i:00' '%Y-%m-%d %H:%i:00'
) AS startTime, ) AS startTime,
</otherwise> </otherwise>
</choose> </choose>
SUM( flow ) AS flow, SUM( flow ) AS flow,
avg( traffic_flow_C ) AS trafficFlowC, COALESCE ( sum( traffic_flow_C ), 0) AS trafficFlowC,
avg( traffic_flow_B ) AS trafficFlowB, COALESCE ( sum( traffic_flow_B ), 0) AS trafficFlowB,
avg( traffic_flow_A ) AS trafficFlowA, COALESCE ( sum( traffic_flow_A ), 0) AS trafficFlowA,
avg( speed ) AS speed, avg( t2.speed ) AS speed,
MAX( queue_length ) AS queueLength, MAX( t2.queue_length ) AS queueLength,
AVG( stop_times ) AS stopTimes AVG( t2.stop_times ) AS stopTimes
FROM FROM
t_cross_data_hist t_base_cross_info t1
LEFT JOIN t_cross_data_hist t2 ON t1.id = t2.cross_id
WHERE 1=1 WHERE 1=1
<if test="crossId != null"> <if test="crossId != null">
AND cross_id = #{crossId} AND t2.cross_id = #{crossId}
</if> </if>
and batch_time <![CDATA[ >= ]]> #{startStamp} and t2.batch_time <![CDATA[ >= ]]> #{startStamp}
and batch_time <![CDATA[ <= ]]> #{endStamp} and t2.batch_time <![CDATA[ <= ]]> #{endStamp}
GROUP BY GROUP BY
cross_id, t2.cross_id,
startTime t2.start_time
ORDER BY ORDER BY
startTime DESC t2.start_time DESC
</select> </select>
<select id="selectMetricHistDTO" resultType="net.wanji.databus.dto.MetricHistDTO"> <select id="selectMetricHistDTO" resultType="net.wanji.databus.dto.MetricHistDTO">
......
<?xml version="1.0" encoding="UTF-8"?><!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.CrossDirDataHistMapper"> <resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossDirDataHistPO"> <result column="id" property="id"></result> <result column="dir_type" property="dirType"></result> <result column="in_out_type" property="inOutType"></result> <result column="cross_id" property="crossId"></result> <result column="length" property="length"></result> <result column="status" property="status"></result> <result column="traffic_index" property="trafficIndex"></result> <result column="start_time" property="startTime"></result> <result column="capacity" property="capacity"></result> <result column="duration" property="duration"></result> <result column="flow" property="flow"></result> <result column="speed" property="speed"></result> <result column="queue_length" property="queueLength"></result> <result column="stop_times" property="stopTimes"></result> <result column="delay_time" property="delayTime"></result> <result column="sturation" property="sturation"></result> <result column="batch_time" property="batchTime"></result> <result column="gmt_create" property="gmtCreate"></result> <result column="gmt_modified" property="gmtModified"></result> <result column="effusion_rate" property="effusionRate"></result> <result column="green_light_efficiency" property="greenLightEfficiency"></result> </resultMap> <sql id="Base_Column_List"> id,dir_type,in_out_type,cross_id,length,status,traffic_index,start_time,capacity,duration,flow,speed,queue_length,stop_times, delay_time,sturation,no_stop_rate,one_stop_rate,two_stop_rate,three_stop_rate,batch_time,gmt_create,gmt_modified,effusion_rate, green_light_efficiency </sql> <insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDirDataHistPO"> insert ignore into t_cross_dir_data_hist (<include refid="Base_Column_List"></include>) values <foreach collection="list" item="entity" separator=","> ( #{entity.id}, #{entity.dirType}, #{entity.inOutType}, #{entity.crossId}, #{entity.length}, #{entity.status}, #{entity.trafficIndex}, #{entity.startTime}, #{entity.capacity}, #{entity.duration}, #{entity.flow}, #{entity.speed}, #{entity.queueLength}, #{entity.stopTimes}, #{entity.delayTime}, #{entity.sturation}, #{entity.noStopRate},#{entity.oneStopRate},#{entity.twoStopRate},#{entity.threeStopRate},#{entity.batchTime}, #{entity.gmtCreate}, #{entity.gmtModified},#{entity.effusionRate},#{entity.greenLightEfficiency}) </foreach> </insert> <delete id="deleteBatch" parameterType="String"> delete from t_cross_dir_data_hist where cross_id in <foreach collection="list" item="crossId" separator="," open="(" close=")"> #{crossId} </foreach> </delete> <select id="selectByCrossIdAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{preSeconds} order by batch_time </select> <select id="selectByCrossIdDirAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ >= ]]> #{preSeconds} order by batch_time </select> <select id="selectByCrossIdInOutTimestamp" resultType="net.wanji.databus.bo.CrossDirDataHistAvgBO"> SELECT dir_type as dirType, avg(capacity) as avgCapacity, avg(flow) as avgFlow, avg(queue_length) as avgQueueLength, avg(traffic_index) as avgIndex, avg(effusion_rate) as avgeffusionRate FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND in_out_type = #{inOutType} AND batch_time <![CDATA[ >= ]]> #{preSeconds} AND batch_time <![CDATA[ < ]]> #{endSeconds} GROUP BY dir_type </select> <select id="selectNoPark" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 2 and dir_type = #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectPhaseQueue" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 2 and dir_type != #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectNoParkEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectPhaseQueueEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type != #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectMetricHistDTO" resultType="net.wanji.databus.dto.MetricHistDTO"> select status, start_time, duration, flow, speed, sturation, capacity, stop_times, delay_time, batch_time, one_stop_rate, queue_length, effusion_rate, no_stop_rate, green_light_efficiency from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} order by batch_time </select> <select id="selectByCrossIdAndStartEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <!-- 方向级查询,条件:路口id、时间、方向 --> <select id="selectByCrossIdAndStartEndDir" resultType="net.wanji.databus.vo.CrossDirDataHistVO"> SELECT cross_id AS crossId, dir_type as dirType, <choose> <!-- 小时 --> <when test="granularity==1"> DATE_FORMAT(start_time, '%Y-%m-%d %H:00:00') AS startTime, </when> <!-- 分钟 --> <otherwise> DATE_FORMAT( CONCAT( DATE ( start_time ), ' ', HOUR ( start_time ), ':', FLOOR( MINUTE ( start_time ) / #{granularity} ) * #{granularity} ), '%Y-%m-%d %H:%i:00' ) AS startTime, </otherwise> </choose> SUM( flow ) AS flow, avg( traffic_flow_C ) AS trafficFlowC, avg( traffic_flow_B ) AS trafficFlowB, avg( traffic_flow_A ) AS trafficFlowA, avg( speed ) AS speed, MAX( queue_length ) AS queueLength, AVG( stop_times ) AS stopTimes FROM t_cross_dir_data_hist WHERE 1=1 <if test="crossId != null"> AND cross_id = #{crossId} </if> <if test="dirTypeList != null"> AND dir_type IN <foreach item="dirType" index="index" collection="dirTypeList" open="(" separator="," close=")"> #{dirType} </foreach> </if> and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} GROUP BY cross_id, dir_type, startTime ORDER BY startTime DESC, dir_type </select> <select id="selectMaxDelayTime" resultType="java.lang.Integer"> select max(delay_time) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxQueueLength" resultType="java.lang.Double"> select max(queue_length) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxSaturation" resultType="java.lang.Double"> select max(sturation) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxGreenLightEfficiency" resultType="java.lang.Double"> select max(green_light_efficiency) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirCode} and in_out_type = #{code} and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} </select> <select id="selectByMetrics" resultType="net.wanji.databus.po.CrossDirDataHistPOExt"> SELECT <include refid="Base_Column_List"/> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND in_out_type = 1 AND dir_type = #{dirInt} AND batch_time <![CDATA[ <= ]]> #{endTimeStamp} AND batch_time <![CDATA[ >= ]]> #{startTimeStamp} </select> <select id="selectByCrossIdsDirsAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"></include> from t_cross_dir_data_hist where cross_id in <foreach collection="crossIdList" item="crossId" separator="," open="(" close=")"> #{crossId} </foreach> and dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} order by batch_time </select> <select id="selectByCrossDirAndTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND dir_type = #{dirCode} AND in_out_type = 1 AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr} AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr} </select> <select id="selectByCrossIdDirsAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"></include> from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} order by batch_time </select> <select id="selectByCrossDirsAndTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> AND in_out_type = 1 AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr} AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr} </select> <select id="selectByTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"><!-- SELECT <include refid="Base_Column_List"></include>--><!-- FROM t_cross_dir_data_hist--><!-- WHERE in_out_type = 1--><!-- AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr}--><!-- AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr}--> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE batch_time BETWEEN UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boStartDayStr}, #{startHourMinuteStr}), '%Y-%m-%d%H:%i')) AND UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boEndDayStr}, #{endHourMinuteStr}), '%Y-%m-%d%H:%i')) AND in_out_type = 1 </select> <select id="selectExtByTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPOExt"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE batch_time BETWEEN UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boStartDayStr}, #{startHourMinuteStr}), '%Y-%m-%d%H:%i')) AND UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boEndDayStr}, #{endHourMinuteStr}), '%Y-%m-%d%H:%i')) AND in_out_type = 1 </select> </mapper> <?xml version="1.0" encoding="UTF-8"?><!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.CrossDirDataHistMapper"> <resultMap id="BaseResultMap" type="net.wanji.databus.po.CrossDirDataHistPO"> <result column="id" property="id"></result> <result column="dir_type" property="dirType"></result> <result column="in_out_type" property="inOutType"></result> <result column="cross_id" property="crossId"></result> <result column="length" property="length"></result> <result column="status" property="status"></result> <result column="traffic_index" property="trafficIndex"></result> <result column="start_time" property="startTime"></result> <result column="capacity" property="capacity"></result> <result column="duration" property="duration"></result> <result column="flow" property="flow"></result> <result column="speed" property="speed"></result> <result column="queue_length" property="queueLength"></result> <result column="stop_times" property="stopTimes"></result> <result column="delay_time" property="delayTime"></result> <result column="sturation" property="sturation"></result> <result column="batch_time" property="batchTime"></result> <result column="gmt_create" property="gmtCreate"></result> <result column="gmt_modified" property="gmtModified"></result> <result column="effusion_rate" property="effusionRate"></result> <result column="green_light_efficiency" property="greenLightEfficiency"></result> </resultMap> <sql id="Base_Column_List"> id,dir_type,in_out_type,cross_id,length,status,traffic_index,start_time,capacity,duration,flow,speed,queue_length,stop_times, delay_time,sturation,no_stop_rate,one_stop_rate,two_stop_rate,three_stop_rate,batch_time,gmt_create,gmt_modified,effusion_rate, green_light_efficiency </sql> <insert id="insertBatch" parameterType="net.wanji.databus.po.CrossDirDataHistPO"> insert ignore into t_cross_dir_data_hist (<include refid="Base_Column_List"></include>) values <foreach collection="list" item="entity" separator=","> ( #{entity.id}, #{entity.dirType}, #{entity.inOutType}, #{entity.crossId}, #{entity.length}, #{entity.status}, #{entity.trafficIndex}, #{entity.startTime}, #{entity.capacity}, #{entity.duration}, #{entity.flow}, #{entity.speed}, #{entity.queueLength}, #{entity.stopTimes}, #{entity.delayTime}, #{entity.sturation}, #{entity.noStopRate},#{entity.oneStopRate},#{entity.twoStopRate},#{entity.threeStopRate},#{entity.batchTime}, #{entity.gmtCreate}, #{entity.gmtModified},#{entity.effusionRate},#{entity.greenLightEfficiency}) </foreach> </insert> <delete id="deleteBatch" parameterType="String"> delete from t_cross_dir_data_hist where cross_id in <foreach collection="list" item="crossId" separator="," open="(" close=")"> #{crossId} </foreach> </delete> <select id="selectByCrossIdAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{preSeconds} order by batch_time </select> <select id="selectByCrossIdDirAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ >= ]]> #{preSeconds} order by batch_time </select> <select id="selectByCrossIdInOutTimestamp" resultType="net.wanji.databus.bo.CrossDirDataHistAvgBO"> SELECT dir_type as dirType, avg(capacity) as avgCapacity, avg(flow) as avgFlow, avg(queue_length) as avgQueueLength, avg(traffic_index) as avgIndex, avg(effusion_rate) as avgeffusionRate FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND in_out_type = #{inOutType} AND batch_time <![CDATA[ >= ]]> #{preSeconds} AND batch_time <![CDATA[ < ]]> #{endSeconds} GROUP BY dir_type </select> <select id="selectNoPark" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 2 and dir_type = #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectPhaseQueue" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 2 and dir_type != #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectNoParkEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectPhaseQueueEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type != #{dir} and batch_time <![CDATA[ <= ]]> #{currentSeconds} and batch_time <![CDATA[ >= ]]> #{preSeconds} </select> <select id="selectMetricHistDTO" resultType="net.wanji.databus.dto.MetricHistDTO"> select status, start_time, duration, flow, speed, sturation, capacity, stop_times, delay_time, batch_time, one_stop_rate, queue_length, effusion_rate, no_stop_rate, green_light_efficiency from t_cross_dir_data_hist where cross_id = #{crossId} and in_out_type = 1 and dir_type = #{dir} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} order by batch_time </select> <select id="selectByCrossIdAndStartEnd" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"/> from t_cross_dir_data_hist where cross_id = #{crossId} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <!-- 方向级查询,条件:路口id、时间、方向 --> <select id="selectByCrossIdAndStartEndDir" resultType="net.wanji.databus.vo.CrossDirDataHistVO"> SELECT t1.cross_id AS crossId, t1.dir_type as dirType, <choose> <!-- 小时 --> <when test="granularity==1"> DATE_FORMAT(t2.start_time, '%Y-%m-%d %H:00:00') AS startTime, </when> <!-- 分钟 --> <otherwise> DATE_FORMAT( CONCAT( DATE ( t2.start_time ), ' ', HOUR ( t2.start_time ), ':', FLOOR( MINUTE ( t2.start_time ) / #{granularity} ) * #{granularity} ), '%Y-%m-%d %H:%i:00' ) AS startTime, </otherwise> </choose> SUM( t2.flow ) AS flow, COALESCE ( sum( t2.traffic_flow_C ), 0 ) AS trafficFlowC, COALESCE ( sum( t2.traffic_flow_B ), 0 ) AS trafficFlowB, COALESCE ( sum( t2.traffic_flow_A ), 0 ) AS trafficFlowA, avg( t2.speed ) AS speed, MAX( t2.queue_length ) AS queueLength, AVG( t2.stop_times ) AS stopTimes FROM t_base_cross_dir_info t1 LEFT JOIN t_cross_dir_data_hist t2 ON t1.id = t2.id WHERE 1=1 <if test="crossId != null"> AND t1.cross_id = #{crossId} </if> <if test="dirTypeList != null"> AND t1.dir_type IN <foreach item="dirType" index="index" collection="dirTypeList" open="(" separator="," close=")"> #{dirType} </foreach> </if> and t2.batch_time <![CDATA[ >= ]]> #{startStamp} and t2.batch_time <![CDATA[ <= ]]> #{endStamp} GROUP BY t1.cross_id, t1.dir_type, t2.start_time ORDER BY t2.start_time DESC, t1.dir_type </select> <select id="selectMaxDelayTime" resultType="java.lang.Integer"> select max(delay_time) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxQueueLength" resultType="java.lang.Double"> select max(queue_length) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxSaturation" resultType="java.lang.Double"> select max(sturation) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirType} and in_out_type = #{inOutType} and batch_time <![CDATA[ >= ]]> #{startStamp} and batch_time <![CDATA[ <= ]]> #{endStamp} </select> <select id="selectMaxGreenLightEfficiency" resultType="java.lang.Double"> select max(green_light_efficiency) from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type = #{dirCode} and in_out_type = #{code} and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} </select> <select id="selectByMetrics" resultType="net.wanji.databus.po.CrossDirDataHistPOExt"> SELECT <include refid="Base_Column_List"/> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND in_out_type = 1 AND dir_type = #{dirInt} AND batch_time <![CDATA[ <= ]]> #{endTimeStamp} AND batch_time <![CDATA[ >= ]]> #{startTimeStamp} </select> <select id="selectByCrossIdsDirsAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"></include> from t_cross_dir_data_hist where cross_id in <foreach collection="crossIdList" item="crossId" separator="," open="(" close=")"> #{crossId} </foreach> and dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} order by batch_time </select> <select id="selectByCrossDirAndTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND dir_type = #{dirCode} AND in_out_type = 1 AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr} AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr} </select> <select id="selectByCrossIdDirsAndTimestamp" resultType="net.wanji.databus.po.CrossDirDataHistPO"> select <include refid="Base_Column_List"></include> from t_cross_dir_data_hist where cross_id = #{crossId} and dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> and in_out_type = 1 and batch_time <![CDATA[ >= ]]> #{startTimeStamp} and batch_time <![CDATA[ <= ]]> #{endTimeStamp} order by batch_time </select> <select id="selectByCrossDirsAndTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE cross_id = #{crossId} AND dir_type in <foreach collection="dirCodeList" item="dirCode" separator="," open="(" close=")"> #{dirCode} </foreach> AND in_out_type = 1 AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr} AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr} </select> <select id="selectByTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPO"><!-- SELECT <include refid="Base_Column_List"></include>--><!-- FROM t_cross_dir_data_hist--><!-- WHERE in_out_type = 1--><!-- AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%Y-%m-%d') BETWEEN #{boStartDayStr} AND #{boEndDayStr}--><!-- AND DATE_FORMAT(FROM_UNIXTIME(batch_time), '%H:%i') BETWEEN #{startHourMinuteStr} AND #{endHourMinuteStr}--> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE batch_time BETWEEN UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boStartDayStr}, #{startHourMinuteStr}), '%Y-%m-%d%H:%i')) AND UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boEndDayStr}, #{endHourMinuteStr}), '%Y-%m-%d%H:%i')) AND in_out_type = 1 </select> <select id="selectExtByTimeSection" resultType="net.wanji.databus.po.CrossDirDataHistPOExt"> SELECT <include refid="Base_Column_List"></include> FROM t_cross_dir_data_hist WHERE batch_time BETWEEN UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boStartDayStr}, #{startHourMinuteStr}), '%Y-%m-%d%H:%i')) AND UNIX_TIMESTAMP(STR_TO_DATE(concat(#{boEndDayStr}, #{endHourMinuteStr}), '%Y-%m-%d%H:%i')) AND in_out_type = 1 </select> </mapper>
\ No newline at end of file \ No newline at end of file
......
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