ParkinglotHeatmapHourSMapper.xml
4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?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.zteits.park.mapper.smapper.ParkinglotHeatmapHourSMapper" >
<resultMap id="BaseResultMap" type="com.zteits.park.domain.ParkinglotHeatmapHour" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="pl_no" property="plNo" jdbcType="VARCHAR" />
<result column="pl_name" property="plName" jdbcType="VARCHAR" />
<result column="pl_province_id" property="plProvinceId" jdbcType="BIGINT" />
<result column="pl_province_name" property="plProvinceName" jdbcType="VARCHAR" />
<result column="pl_city_id" property="plCityId" jdbcType="BIGINT" />
<result column="pl_city_name" property="plCityName" jdbcType="VARCHAR" />
<result column="pl_country_id" property="plCountryId" jdbcType="BIGINT" />
<result column="pl_country_name" property="plCountryName" jdbcType="VARCHAR" />
<result column="lon" property="lon" jdbcType="DECIMAL" />
<result column="lat" property="lat" jdbcType="DECIMAL" />
<result column="current_park_count" property="currentParkCount" jdbcType="INTEGER" />
<result column="ranges" property="ranges" jdbcType="INTEGER" />
<result column="heatmap_hour" property="heatmapHour" jdbcType="VARCHAR" />
<result column="heatmap_time" property="heatmapTime" jdbcType="TIMESTAMP" />
<result column="remark" property="remark" jdbcType="VARCHAR" />
<result column="data_status" property="dataStatus" jdbcType="INTEGER" />
<result column="create_empid" property="createEmpid" jdbcType="VARCHAR" />
<result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
<result column="modfiy_empid" property="modfiyEmpid" jdbcType="VARCHAR" />
<result column="modfiy_date" property="modfiyDate" jdbcType="TIMESTAMP" />
</resultMap>
<sql id="Base_Column_List" >
id, pl_no, pl_name, pl_province_id, pl_province_name, pl_city_id, pl_city_name, pl_country_id,
pl_country_name, lon, lat, current_park_count, ranges, heatmap_hour, heatmap_time,
remark, data_status, create_empid, create_date, modfiy_empid, modfiy_date
</sql>
<!-- 批量插入 -->
<insert id="insertParkinglotHeatmapHourList" parameterType="java.util.List">
INSERT INTO
parkinglot_heatmap_hour ( pl_no, pl_name, pl_province_id, pl_province_name, pl_city_id, pl_city_name, pl_country_id,
pl_country_name, lon, lat, current_park_count, ranges, heatmap_hour, heatmap_time,
remark, data_status, create_empid, create_date, modfiy_empid, modfiy_date) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.plNo,jdbcType=VARCHAR}, #{item.plName,jdbcType=VARCHAR},
#{item.plProvinceId,jdbcType=BIGINT}, #{item.plProvinceName,jdbcType=VARCHAR}, #{item.plCityId,jdbcType=BIGINT},
#{item.plCityName,jdbcType=VARCHAR}, #{item.plCountryId,jdbcType=BIGINT}, #{item.plCountryName,jdbcType=VARCHAR},
#{item.lon,jdbcType=DECIMAL}, #{item.lat,jdbcType=DECIMAL}, #{item.currentParkCount,jdbcType=INTEGER},
#{item.ranges,jdbcType=INTEGER}, #{item.heatmapHour,jdbcType=VARCHAR}, #{item.heatmapTime,jdbcType=TIMESTAMP},
#{item.remark,jdbcType=VARCHAR}, #{item.dataStatus,jdbcType=INTEGER}, #{item.createEmpid,jdbcType=VARCHAR},
#{item.createDate,jdbcType=TIMESTAMP}, #{item.modfiyEmpid,jdbcType=VARCHAR}, #{item.modfiyDate,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
<!-- 查询热力分布数据 -->
<select id="queryParkHeatmapByHour" resultType="com.zteits.park.domain.ParkinglotHeatmapHour" >
select
lon as lon, lat as lat,AVG(current_park_count) AS currentParkCount
from parkinglot_heatmap_hour
where data_status = 1
and pl_province_id = #{provId}
and pl_city_id = #{cityId}
AND DATE_FORMAT(heatmap_time,'%H') = DATE_FORMAT(#{queryDate},'%H')
GROUP BY DATE_FORMAT(heatmap_time,'%H'),lon,lat
</select>
<!-- 根据heatmapTime 时间删除数据. -->
<delete id="deleteParkinglotHeatmapHourByheatmapTime" >
delete from parkinglot_heatmap_hour where heatmap_time=#{heatmapTime}
and pl_city_id=#{cityId}
</delete>
</mapper>