TpPNetworkCardSMapper.xml
5.12 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
<?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.TpPNetworkCardSMapper">
<resultMap id="BaseResultMap" type="com.zteits.park.domain.TpPNetworkCard">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="operator_type" jdbcType="INTEGER" property="operatorType" />
<result column="operator_name" jdbcType="VARCHAR" property="operatorName" />
<result column="pl_no" jdbcType="VARCHAR" property="plNo" />
<result column="card_no" jdbcType="VARCHAR" property="cardNo" />
<result column="rate_plan" jdbcType="VARCHAR" property="ratePlan" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="is_online" jdbcType="INTEGER" property="isOnline" />
<result column="mobile_data_total" jdbcType="BIGINT" property="mobileDataTotal" />
<result column="mobile_data_use" jdbcType="BIGINT" property="mobileDataUse" />
<result column="mobile_data_limit_reached" jdbcType="INTEGER" property="mobileDataLimitReached" />
<result column="eqp_type" jdbcType="INTEGER" property="eqpType" />
<result column="eqp_no" jdbcType="VARCHAR" property="eqpNo" />
<result column="eqp_name" jdbcType="VARCHAR" property="eqpName" />
<result column="eqp_imei" jdbcType="VARCHAR" property="eqpImei" />
<result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="org_id" jdbcType="BIGINT" property="orgId" />
<result column="data_state" jdbcType="INTEGER" property="dataState" />
<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
<result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
<result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
<result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
<result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
<result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
</resultMap>
<sql id="Base_Column_List">
id, operator_type, operator_name, pl_no, card_no, rate_plan, status, is_online, mobile_data_total,
mobile_data_use, mobile_data_limit_reached, eqp_type, eqp_no, eqp_name, eqp_imei,
remark, org_id, data_state, create_date, create_emp_id, create_emp_name, modfiy_date,
modfiy_emp_id, modfiy_emp_name
</sql>
<!-- 物联网卡分页查询 -->
<select id="queryTpPNetworkCardForPage" parameterType="com.zteits.clouds.api.dto.park.param.TpPNetworkCardRequest"
resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tp_p_network_card
where data_state = 1
<if test="cardNo != null and cardNo != ''">
and card_no = #{cardNo,jdbcType=VARCHAR}
</if>
<if test="isOnline != null">
and is_online = #{isOnline,jdbcType=INTEGER}
</if>
<if test="mobileDataLimitReached != null">
and mobile_data_limit_reached = #{mobileDataLimitReached,jdbcType=INTEGER}
</if>
<if test="eqpType != null">
and eqp_type = #{eqpType,jdbcType=INTEGER}
</if>
<if test="orgId != null">
and org_id = #{orgId,jdbcType=BIGINT}
</if>
</select>
<!-- 物联网卡分页查询 -->
<select id="queryTpPNetworkCardStatistic" parameterType="com.zteits.clouds.api.dto.park.param.TpPNetworkCardRequest"
resultType="com.zteits.clouds.api.dto.park.dto.networkcard.TpPNetworkCardStatisticDTO">
select sum(1) totalNum,
sum(case when mobile_data_limit_reached = 1 then 1 else 0 end) dataOverNum,
sum(case when mobile_data_limit_reached = 0 then 1 else 0 end) dataNoOverNum,
sum(case when is_online = 1 then 1 else 0 end) onlineNum,
sum(case when is_online = 0 then 1 else 0 end) noOnlineNum,
sum(case when eqp_type = 1 || eqp_type = 2 || eqp_type = 3 || eqp_type = 9 then mobile_data_use else 0 end) roadData,
sum(case when eqp_type = 10 then mobile_data_use else 0 end) closeParkData,
sum(case when eqp_type = 11 || eqp_type = 12 || eqp_type = 13 then mobile_data_use else 0 end) guideData,
sum(case when eqp_type is null then mobile_data_use else 0 end) ortherData,
sum(mobile_data_use) totalData
from tp_p_network_card
where data_state = 1
<if test="cardNo != null and cardNo != ''">
and card_no = #{cardNo,jdbcType=VARCHAR}
</if>
<if test="isOnline != null">
and is_online = #{isOnline,jdbcType=INTEGER}
</if>
<if test="mobileDataLimitReached != null">
and mobile_data_limit_reached = #{mobileDataLimitReached,jdbcType=INTEGER}
</if>
<if test="eqpType != null">
and eqp_type = #{eqpType,jdbcType=INTEGER}
</if>
<if test="orgId != null">
and org_id = #{orgId,jdbcType=BIGINT}
</if>
</select>
</mapper>