|
@@ -3,34 +3,56 @@
|
3
|
3
|
<mapper namespace="com.unis.visualization.modular.grainOilReserve.mapper.GrainOilReserveMapper">
|
4
|
4
|
|
5
|
5
|
<select id="getStorehouseCapacity" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart">
|
6
|
|
- SELECT ROUND(SUM(designCapacity)/10000,3) as designCapacity FROM (
|
7
|
|
- SELECT SUM(IFNULL(a.design_capacity,0.0)) as designCapacity FROM depot_qh.basic_storehouse a where a.del_flag =1
|
|
6
|
+ SELECT ROUND(SUM(designCapacity)/10000,3) as designCapacity FROM (
|
|
7
|
+ SELECT IFNULL(a.design_capacity,0.0) as designCapacity,org_id as orgId FROM depot_qh.basic_storehouse a where a.del_flag =1
|
8
|
8
|
UNION ALL
|
9
|
|
- SELECT SUM(IFNULL(a.tank_capacity,0.0)) as designCapacity FROM depot_qh.basic_tank a where a.del_flag =1
|
|
9
|
+ SELECT IFNULL(a.tank_capacity,0.0) as designCapacity,org_id as orgId FROM depot_qh.basic_tank a where a.del_flag =1
|
10
|
10
|
) x
|
|
11
|
+ LEFT JOIN depot_qh.org_info b on x.orgId = b.org_id
|
|
12
|
+ LEFT JOIN province_all.biz_unit_info c on b.unit_info_id = c.id
|
|
13
|
+ <if test="cityId != null and cityId != ''">
|
|
14
|
+ where c.zcdz_city = #{cityId}
|
|
15
|
+ </if>
|
11
|
16
|
</select>
|
12
|
17
|
<select id="getStorehouseStock" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart">
|
13
|
18
|
SELECT ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) as kcsl FROM depot_qh.data_kcgl_kcsw_default a
|
|
19
|
+ LEFT JOIN depot_qh.org_info b on a.UnitID = b.org_id
|
|
20
|
+ LEFT JOIN province_all.biz_unit_info c on b.unit_info_id = c.id
|
|
21
|
+ <if test="cityId != null and cityId != ''">
|
|
22
|
+ where c.zcdz_city = #{cityId}
|
|
23
|
+ </if>
|
14
|
24
|
</select>
|
15
|
25
|
<select id="getYesteryearStorehouseStock" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart">
|
16
|
|
- SELECT ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) yesterYearKcsl
|
|
26
|
+ SELECT ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) yesterYearKcsl
|
17
|
27
|
FROM (
|
18
|
|
- SELECT *,
|
19
|
|
- ROW_NUMBER() OVER (PARTITION BY hwh ORDER BY rq DESC) AS rn
|
20
|
|
- FROM depot_qh.data_kcgl_fcbgz_default where DATE_FORMAT(DATE_ADD(NOW(),INTERVAL -1 YEAR),'%Y-%m-%d') >= DATE_FORMAT(rq,'%Y-%m-%d')
|
|
28
|
+ SELECT a.kcsl,
|
|
29
|
+ ROW_NUMBER() OVER (PARTITION BY a.hwh ORDER BY a.rq DESC) AS rn
|
|
30
|
+ FROM depot_qh.data_kcgl_fcbgz_default a
|
|
31
|
+ LEFT JOIN depot_qh.org_info b on a.UnitID = b.org_id
|
|
32
|
+ LEFT JOIN province_all.biz_unit_info c on b.unit_info_id = c.id
|
|
33
|
+ where DATE_FORMAT(DATE_ADD(NOW(),INTERVAL -1 YEAR),'%Y-%m-%d') >= DATE_FORMAT(a.rq,'%Y-%m-%d')
|
|
34
|
+ <if test="cityId != null and cityId != ''">
|
|
35
|
+ and c.zcdz_city = #{cityId}
|
|
36
|
+ </if>
|
21
|
37
|
) t
|
22
|
38
|
WHERE rn = 1;
|
23
|
39
|
|
24
|
40
|
</select>
|
25
|
41
|
<select id="getVarietyChartDatas" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.VarietyCapacityChart">
|
26
|
42
|
SELECT
|
27
|
|
- a.pz ,
|
28
|
|
- b.enumname pzName,
|
29
|
|
- ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) as kcsl FROM depot_qh.data_kcgl_kcsw_default a
|
30
|
|
- LEFT JOIN depot_qh.basic_enum b on a.pz = b.enumId
|
|
43
|
+ a.pz ,
|
|
44
|
+ e.enumname pzName,
|
|
45
|
+ ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) as kcsl
|
|
46
|
+ FROM depot_qh.data_kcgl_kcsw_default a
|
|
47
|
+ LEFT JOIN depot_qh.basic_enum e on a.pz = e.enumId
|
|
48
|
+ LEFT JOIN depot_qh.org_info b on a.UnitID = b.org_id
|
|
49
|
+ LEFT JOIN province_all.biz_unit_info c on b.unit_info_id = c.id
|
|
50
|
+ <if test="cityId != null and cityId != ''">
|
|
51
|
+ where c.zcdz_city = #{cityId}
|
|
52
|
+ </if>
|
31
|
53
|
GROUP BY
|
32
|
54
|
a.pz,
|
33
|
|
- b.enumname
|
|
55
|
+ e.enumname
|
34
|
56
|
ORDER BY a.pz
|
35
|
57
|
</select>
|
36
|
58
|
<select id="getGradeChartDatas" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.GradeCapacityChart">
|
|
@@ -47,7 +69,12 @@
|
47
|
69
|
ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) as sumZl FROM depot_qh.data_kcgl_kcsw_default a
|
48
|
70
|
LEFT JOIN depot_qh.basic_enum b on a.pz = b.enumId
|
49
|
71
|
LEFT JOIN depot_qh.basic_enum c on a.dj = c.enumId
|
|
72
|
+ LEFT JOIN depot_qh.org_info d on a.UnitID = d.org_id
|
|
73
|
+ LEFT JOIN province_all.biz_unit_info e on d.unit_info_id = e.id
|
50
|
74
|
where a.dj in (3271,3272,3273)
|
|
75
|
+ <if test="cityId != null and cityId != ''">
|
|
76
|
+ and e.zcdz_city = #{cityId}
|
|
77
|
+ </if>
|
51
|
78
|
GROUP by
|
52
|
79
|
a.dj,a.pz
|
53
|
80
|
) x
|
|
@@ -79,6 +106,9 @@ ORDER by pz
|
79
|
106
|
LEFT JOIN depot_qh.basic_enum e on e.enumId = a.pz
|
80
|
107
|
where
|
81
|
108
|
d.PARENT_ID = '1781535965870915586'
|
|
109
|
+ <if test="cityId != null and cityId != ''">
|
|
110
|
+ and c.zcdz_city = #{cityId}
|
|
111
|
+ </if>
|
82
|
112
|
GROUP BY
|
83
|
113
|
d.ID,d.DICT_LABEL,a.pz,e.enumname
|
84
|
114
|
) x
|
|
@@ -100,7 +130,12 @@ ORDER by pz
|
100
|
130
|
left JOIN depot_qh.data_crkyw_ckcmz_default b ON a.BizNo = b.BizNo
|
101
|
131
|
LEFT JOIN depot_qh.data_crkyw_ckcm_default c on a.BizNo = c.BizNo
|
102
|
132
|
LEFT JOIN depot_qh.basic_enum d on a.lspz = d.enumId
|
|
133
|
+ LEFT JOIN depot_qh.org_info m1 on a.UnitID = m1.org_id
|
|
134
|
+ LEFT JOIN province_all.biz_unit_info m2 on m1.unit_info_id = m2.id
|
103
|
135
|
where DATE_FORMAT(a.rmsj,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
136
|
+ <if test="cityId != null and cityId != ''">
|
|
137
|
+ and m2.zcdz_city = #{cityId}
|
|
138
|
+ </if>
|
104
|
139
|
GROUP BY a.lspz,d.enumname
|
105
|
140
|
</when >
|
106
|
141
|
<otherwise >
|
|
@@ -115,7 +150,12 @@ ORDER by pz
|
115
|
150
|
left JOIN depot_qh.data_crkyw_cpz_default b ON a.BizNo = b.BizNo
|
116
|
151
|
LEFT JOIN depot_qh.data_crkyw_rkcm_default c on a.BizNo = c.BizNo
|
117
|
152
|
LEFT JOIN depot_qh.basic_enum d on a.lspz = d.enumId
|
|
153
|
+ LEFT JOIN depot_qh.org_info m1 on a.UnitID = m1.org_id
|
|
154
|
+ LEFT JOIN province_all.biz_unit_info m2 on m1.unit_info_id = m2.id
|
118
|
155
|
where DATE_FORMAT(a.ywdjsj,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
|
|
156
|
+ <if test="cityId != null and cityId != ''">
|
|
157
|
+ and m2.zcdz_city = #{cityId}
|
|
158
|
+ </if>
|
119
|
159
|
GROUP BY a.lspz,d.enumname
|
120
|
160
|
</otherwise>
|
121
|
161
|
</choose>
|