ChannelRiskDataMapper.xml
4.42 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?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="cn.com.glsx.datariskcon.modules.mapper.ChannelRiskDataMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.datariskcon.modules.entity.ChannelRiskData">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="workorder_no" jdbcType="VARCHAR" property="workorder_no"/>
<result column="owner_name" jdbcType="VARCHAR" property="owner_name"/>
<result column="vin" jdbcType="VARCHAR" property="vin"/>
<result column="sn" jdbcType="VARCHAR" property="sn"/>
<result column="active_date" jdbcType="TIMESTAMP" property="active_date"/>
<result column="dev_type" jdbcType="INTEGER" property="dev_type"/>
<result column="gps_time" jdbcType="TIMESTAMP" property="gps_time"/>
<result column="lng" jdbcType="DOUBLE" property="lng"/>
<result column="lat" jdbcType="DOUBLE" property="lat"/>
<result column="prov" jdbcType="VARCHAR" property="prov"/>
<result column="city" jdbcType="VARCHAR" property="city"/>
<result column="zone" jdbcType="VARCHAR" property="zone"/>
<result column="address" jdbcType="VARCHAR" property="address"/>
<result column="shop_name" jdbcType="VARCHAR" property="shop_name"/>
<result column="labels" jdbcType="VARCHAR" property="labels"/>
<result column="type" jdbcType="INTEGER" property="type"/>
</resultMap>
<sql id="Base_Column_List">
id, workorder_no, owner_name,vin, sn, active_date, dev_type,gps_time, lng,
lat, prov,city,zone,address,shop_name,labels,type
</sql>
<select id="findChannelAllRiskData" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
FROM t_channel_risk_data
<if test="isExcep == 'true'">
where type=1
</if>
<if test="isExcep == 'false'">
where type=0
</if>
</select>
<select id="findProInstallSheet" resultType="java.util.Map">
select
prov as xAxis,count(prov) as value
from t_channel_risk_data
where gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH)
and type=0
group by prov
</select>
<select id="findCityInstallSheet" resultType="java.util.Map">
select
city as xAxis,count(city) as value
from t_channel_risk_data
where prov=#{proviceName} and gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH)
and type=0
group by city
</select>
<select id="findZoneInstallSheet" resultType="java.util.Map">
select
zone as xAxis,count(zone) as value
from t_channel_risk_data
where city=#{cityName} and gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH)
and type=0
group by zone
</select>
<select id="findTimeInstallSheet" resultType="java.util.Map">
select
concat(DATE_FORMAT(gps_time,'%m'),'月') as xAxis,
count(id) as value
from t_channel_risk_data
where gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH)
and type=0
group by xAxis
</select>
<select id="findProTimeInstallSheet" resultType="java.util.Map">
select
concat(DATE_FORMAT(gps_time,'%m'),'月') as xAxis,
count(id) as value
from t_channel_risk_data
where gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH)
and type=0
and prov=#{proviceName}
group by xAxis
</select>
<select id="findCityTimeInstallSheet" resultType="java.util.Map">
select
concat(DATE_FORMAT(gps_time,'%m'),'月') as xAxis,
count(id) as value
from t_channel_risk_data
where gps_time>=DATE_SUB(last_day(curdate()), INTERVAL #{monthNum} MONTH,'%Y-%m')
and type=0
and city=#{cityName}
group by xAxis
</select>
<select id="findOutletsData" resultType="java.util.Map">
select
shop_name,address,count(shop_name) as orderCount
FROM t_channel_risk_data
where type=1
group by shop_name
</select>
<select id="findOutletsDataDetail" resultMap="BaseResultMap">
select active_date,owner_name,vin,sn,address
from t_channel_risk_data
where type=1 and shop_name=#{shopname}
</select>
</mapper>