Blame view

parking-module-order/src/main/resources/mybatis/mapper/smapper/DurationStatisticParkWeekSMapper.xml 4.84 KB
55f68655   王彪总   新项目
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
  <?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.order.mapper.smapper.DurationStatisticParkWeekSMapper">
    <resultMap id="BaseResultMap" type="com.zteits.order.domain.DurationStatisticParkWeek">
      <id column="id" jdbcType="BIGINT" property="id" />
      <result column="static_date" jdbcType="DATE" property="staticDate" />
      <result column="static_date_str" jdbcType="VARCHAR" property="staticDateStr" />
      <result column="org_id" jdbcType="INTEGER" property="orgId" />
      <result column="area_id" jdbcType="VARCHAR" property="areaId" />
      <result column="area_name" jdbcType="VARCHAR" property="areaName" />
      <result column="pl_no" jdbcType="VARCHAR" property="plNo" />
      <result column="pl_name" jdbcType="VARCHAR" property="plName" />
      <result column="berth_num" jdbcType="INTEGER" property="berthNum" />
      <result column="total_duration" jdbcType="BIGINT" property="totalDuration" />
      <result column="total_parking_times" jdbcType="INTEGER" property="totalParkingTimes" />
      <result column="avg_berth_duration" jdbcType="BIGINT" property="avgBerthDuration" />
      <result column="avg_times_duration" jdbcType="BIGINT" property="avgTimesDuration" />
      <result column="min_15" jdbcType="INTEGER" property="min15" />
      <result column="min_30" jdbcType="INTEGER" property="min30" />
      <result column="hour_1" jdbcType="INTEGER" property="hour1" />
      <result column="hour_6" jdbcType="INTEGER" property="hour6" />
      <result column="hour_12" jdbcType="INTEGER" property="hour12" />
      <result column="hour_24" jdbcType="INTEGER" property="hour24" />
      <result column="day_1" jdbcType="INTEGER" property="day1" />
      <result column="data_state" jdbcType="INTEGER" property="dataState" />
      <result column="create_emp_id" jdbcType="VARCHAR" property="createEmpId" />
      <result column="create_emp_name" jdbcType="VARCHAR" property="createEmpName" />
      <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
      <result column="modfiy_emp_id" jdbcType="VARCHAR" property="modfiyEmpId" />
      <result column="modfiy_emp_name" jdbcType="VARCHAR" property="modfiyEmpName" />
      <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
      <result column="remark" jdbcType="VARCHAR" property="remark" />
      <result column="pl_type" jdbcType="INTEGER" property="plType" />
    </resultMap>
    
      <!-- 停车时长汇总(按周) -->
      <select id="queryDurationStatisticParkWeekTotal" resultType="com.zteits.clouds.api.dto.order.duration.dto.DurationParkTotalDTO" 
          parameterType="com.zteits.clouds.api.dto.order.duration.param.DurationParkReq">
         SELECT b.*,
  	       IFNULL(b.totalDuration/b.berthNum,0) avgBerthDuration,
  	       IFNULL(b.totalDuration/b.totalParkingTimes,0) avgTimesDuration
  	       from(
  	            SELECT
  	            count(DISTINCT(a.pl_no)) as parkNum,
  	            a.pl_type as plType,
  	            MAX(a.static_date_str) as staticDateStr,
  	            sum((IFNULL(a.berth_num,0))) as berthNum,
  	            sum(IFNULL(a.total_duration,0)) as totalDuration,
  	            sum(IFNULL(a.total_parking_times,0)) as totalParkingTimes
  	        FROM
  	            duration_statistic_park_week a
  	        where 1=1
  	          and a.data_state=1
  	          and a.static_date between #{beginTime} and #{endTime}
  	          and a.week_num = #{weekNum}
  	          and a.pl_no in
  	            <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
  	                #{plNo}
  	            </foreach>
  	         group by a.pl_type)b
      </select>
      
      <!-- 停车时长分布(按周) -->
      <select id="queryParkDurationWeekDistribute" resultType="com.zteits.clouds.api.dto.order.duration.dto.DurationParkDistDTO" 
          parameterType="com.zteits.clouds.api.dto.order.duration.param.DurationParkReq">
             SELECT
                  a.pl_type as plType,
                  MAX(a.static_date_str) as staticDateStr,
                  sum((IFNULL(a.min_15,0))) as min15,
                  sum(IFNULL(a.min_30,0)) as min30,
                  sum(IFNULL(a.hour_1,0)) as hour1,
                  sum(IFNULL(a.hour_6,0)) as hour6,
                  sum(IFNULL(a.hour_12,0)) as hour12,
                  sum(IFNULL(a.hour_24,0)) as hour24,
                  sum(IFNULL(a.day_1,0)) as day1,
                  sum(IFNULL(a.total_parking_times,0)) as totalParkingTimes
              FROM
                  duration_statistic_park_week a
              where 1=1
                and a.data_state=1
                and a.static_date between #{beginTime} and #{endTime}
                and a.week_num = #{weekNum}
                and a.pl_no in
                  <foreach collection="plNos" open="(" close=")" item="plNo" separator=",">
                      #{plNo}
                  </foreach>
               group by a.pl_type
      </select>
      
  </mapper>