|
|
|
<?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="com.zc.business.mapper.DcGantryMetricsStatisticsDataMapper">
|
|
|
|
<resultMap type="map" id="countMap">
|
|
|
|
<result property="id" column="id"/>
|
|
|
|
<result property="facilityName" column="facility_name"/>
|
|
|
|
<result property="stakeMark" column="stake_mark"/>
|
|
|
|
<result property="direction" column="direction"/>
|
|
|
|
<result property="gantryCode" column="gantry_code"/>
|
|
|
|
<result property="trafficCompositionRate" column="traffic_composition_rate"/>
|
|
|
|
<result property="crowdingRate" column="crowding_rate"/>
|
|
|
|
<result property="saturationRate" column="saturation_rate"/>
|
|
|
|
<result property="statisticalDate" column="statistical_date"/>
|
|
|
|
</resultMap>
|
|
|
|
<!-- 插入或更新门架指标数据 -->
|
|
|
|
<insert id="insertOrUpdate" parameterType="com.zc.business.domain.DcGantryMetricsStatisticsData">
|
|
|
|
INSERT INTO
|
|
|
|
dc_gantry_metrics_statistics_data
|
|
|
|
(
|
|
|
|
id,
|
|
|
|
gantry_code,
|
|
|
|
statistical_date,
|
|
|
|
period_type,
|
|
|
|
crowding_rate,
|
|
|
|
traffic_composition_rate,
|
|
|
|
saturation_rate,
|
|
|
|
create_time
|
|
|
|
)
|
|
|
|
VALUES
|
|
|
|
(
|
|
|
|
#{id},
|
|
|
|
#{gantryCode},
|
|
|
|
#{statisticalDate},
|
|
|
|
#{periodType},
|
|
|
|
#{crowdingRate},
|
|
|
|
#{trafficCompositionRate},
|
|
|
|
#{saturationRate},
|
|
|
|
NOW())
|
|
|
|
ON DUPLICATE KEY UPDATE
|
|
|
|
gantry_code = VALUES(gantry_code),
|
|
|
|
statistical_date = VALUES(statistical_date),
|
|
|
|
period_type = VALUES(period_type),
|
|
|
|
crowding_rate = VALUES(crowding_rate),
|
|
|
|
traffic_composition_rate = VALUES(traffic_composition_rate),
|
|
|
|
saturation_rate = VALUES(saturation_rate),
|
|
|
|
update_time = NOW()
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<insert id="insertOrUpdateBatch" parameterType="list">
|
|
|
|
INSERT INTO
|
|
|
|
dc_gantry_metrics_statistics_data
|
|
|
|
(
|
|
|
|
id,
|
|
|
|
gantry_code,
|
|
|
|
statistical_date,
|
|
|
|
period_type,
|
|
|
|
crowding_rate,
|
|
|
|
traffic_composition_rate,
|
|
|
|
saturation_rate,
|
|
|
|
create_time
|
|
|
|
)
|
|
|
|
VALUES
|
|
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
|
|
(
|
|
|
|
#{item.id},
|
|
|
|
#{item.gantryCode},
|
|
|
|
#{item.statisticalDate},
|
|
|
|
#{item.periodType},
|
|
|
|
#{item.crowdingRate},
|
|
|
|
#{item.trafficCompositionRate},
|
|
|
|
#{item.saturationRate},
|
|
|
|
NOW()
|
|
|
|
)
|
|
|
|
</foreach>
|
|
|
|
ON DUPLICATE KEY UPDATE
|
|
|
|
gantry_code = VALUES(gantry_code),
|
|
|
|
statistical_date = VALUES(statistical_date),
|
|
|
|
period_type = VALUES(period_type),
|
|
|
|
crowding_rate = VALUES(crowding_rate),
|
|
|
|
traffic_composition_rate = VALUES(traffic_composition_rate),
|
|
|
|
saturation_rate = VALUES(saturation_rate),
|
|
|
|
update_time = NOW()
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
<select id="sectionTrafficIndexAnalysis" resultMap="countMap" resultType="map" >
|
|
|
|
SELECT fa.facility_name,
|
|
|
|
fa.stake_mark,
|
|
|
|
fa.direction,
|
|
|
|
dg.statistical_date,
|
|
|
|
dg.gantry_code,
|
|
|
|
dg.id,
|
|
|
|
dg.traffic_composition_rate,
|
|
|
|
dg.crowding_rate,
|
|
|
|
dg.saturation_rate
|
|
|
|
FROM dc_gantry_metrics_statistics_data as dg
|
|
|
|
LEFT JOIN dc_facility as fa on fa.facility_code = dg.gantry_code
|
|
|
|
WHERE DATE(dg.statistical_date) = #{startDate}
|
|
|
|
AND fa.direction = #{direction}
|
|
|
|
AND dg.period_type = #{periodType}
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|