|
@@ -0,0 +1,75 @@
|
|
1
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
3
|
+<mapper namespace="com.gct.centralbase.mapper.CbTempWellMechRuntimeMapper">
|
|
4
|
+
|
|
5
|
+ <cache flushInterval="6000000" size="5096"/>
|
|
6
|
+
|
|
7
|
+ <!-- 通用查询映射结果 -->
|
|
8
|
+ <resultMap id="BaseResultMap" type="com.gct.centralbase.entity.CbTempWellMechRuntime">
|
|
9
|
+ <result column="well_id" property="wellId" />
|
|
10
|
+ <result column="prod_date" property="prodDate" />
|
|
11
|
+ <result column="theo_discharge" property="theoDischarge" />
|
|
12
|
+ <result column="indi_diagram_interp_code" property="indiDiagramInterpCode" />
|
|
13
|
+ <result column="dynamic_liq_level" property="dynamicLiqLevel" />
|
|
14
|
+ <result column="static_liq_lev" property="staticLiqLev" />
|
|
15
|
+ <result column="static_pressure" property="staticPressure" />
|
|
16
|
+ <result column="flow_pres" property="flowPres" />
|
|
17
|
+ <result column="pump_diameter" property="pumpDiameter" />
|
|
18
|
+ <result column="pump_depth" property="pumpDepth" />
|
|
19
|
+ <result column="pump_efficiency" property="pumpEfficiency" />
|
|
20
|
+ <result column="rotate_frequency" property="rotateFrequency" />
|
|
21
|
+ <result column="stroke_length" property="strokeLength" />
|
|
22
|
+ <result column="stroke_frequency" property="strokeFrequency" />
|
|
23
|
+ <result column="susp_max_load" property="suspMaxLoad" />
|
|
24
|
+ <result column="susp_min_load" property="suspMinLoad" />
|
|
25
|
+ <result column="pump_tag_discharge" property="pumpTagDischarge" />
|
|
26
|
+ <result column="rep_pressure_gradient_flow" property="repPressureGradientFlow" />
|
|
27
|
+ <result column="pump_type" property="pumpType" />
|
|
28
|
+ <result column="electromotor_power" property="electromotorPower" />
|
|
29
|
+ <result column="elec_frequency" property="elecFrequency" />
|
|
30
|
+ <result column="diagram_interp_code_time" property="diagramInterpCodeTime" />
|
|
31
|
+ <result column="sgt" property="sgt" />
|
|
32
|
+ <result column="elec_pump_current_a" property="elecPumpCurrentA" />
|
|
33
|
+ <result column="elec_pump_current_b" property="elecPumpCurrentB" />
|
|
34
|
+ <result column="elec_pump_current_c" property="elecPumpCurrentC" />
|
|
35
|
+ <result column="dgt" property="dgt" />
|
|
36
|
+ </resultMap>
|
|
37
|
+ <select id="getErrorData" resultType="java.util.Map">
|
|
38
|
+ delete from centralbase.cb_runtime_error where prod_date::date =#{localDateTime};
|
|
39
|
+ insert into centralbase.cb_runtime_error
|
|
40
|
+ select t3.org_name org,prod_date,sum(frequencyzero) frequencyzero , sum(frequencynull) frequencynull ,sum(frequencylit) frequencylit ,sum(frequencyok) frequencyok,
|
|
41
|
+ sum(strokezero) strokezero,sum(strokenull) strokenull,sum(strokelit) strokelit,sum(strokeok) strokeok,
|
|
42
|
+ sum(sgtnullstr) sgtnullstr,sum(sgtnull) sgtnull,sum(sgtok) sgtok from (
|
|
43
|
+ select rn.well_id,#{localDateTime}::date prod_date,
|
|
44
|
+ sum(case when rn.stroke_frequency=0 then 1 else 0 end ) frequencyzero ,
|
|
45
|
+ sum(case when rn.stroke_frequency is null then 1 else 0 end ) frequencynull,
|
|
46
|
+ sum(case when rn.stroke_frequency >12 or rn.stroke_frequency < 0 then 1 else 0 end ) frequencylit,
|
|
47
|
+ sum(case when rn.stroke_frequency <12 and rn.stroke_frequency > 0 then 1 else 0 end ) frequencyok,
|
|
48
|
+ sum(case when rn.stroke_length = 0 then 1 else 0 end ) strokezero,
|
|
49
|
+ sum(case when rn.stroke_length is null then 1 else 0 end ) strokenull,
|
|
50
|
+ sum(case when rn.stroke_length >12 or rn.stroke_length < 0 then 1 else 0 end ) strokelit,
|
|
51
|
+ sum(case when rn.stroke_length < 12 and rn.stroke_length > 0 then 1 else 0 end ) strokeok,
|
|
52
|
+ sum(case when rn.sgt ='' then 1 else 0 end ) sgtnullstr,
|
|
53
|
+ sum(case when rn.sgt is null then 1 else 0 end ) sgtnull,
|
|
54
|
+ sum(case when rn.sgt !='' and sgt is not null then 1 else 0 end ) sgtok
|
|
55
|
+ from centralbase.cb_temp_well_mech_runtime rn
|
|
56
|
+ where rn.prod_date::date=#{localDateTime} group by rn.well_id
|
|
57
|
+ ) dat
|
|
58
|
+ left join centralbase.cb_cd_well_source t0 on dat.well_id=t0.well_id
|
|
59
|
+ left join centralbase.cb_pc_organization t1 on t0.org_id=t1.org_id
|
|
60
|
+ left join centralbase.cb_pc_organization t2 on t1.parent_id=t2.org_id
|
|
61
|
+ left join centralbase.cb_pc_organization t3 on t2.parent_id=t3.org_id
|
|
62
|
+ group by t3.org_name,prod_date
|
|
63
|
+ </select>
|
|
64
|
+ <select id="getErrorDataInfo" resultType="java.util.Map">
|
|
65
|
+ select * from centralbase.cb_runtime_error where prod_date::date =#{prodDate} and org_name !=''
|
|
66
|
+ </select>
|
|
67
|
+
|
|
68
|
+ <select id="createTableWithCbRunTime">
|
|
69
|
+ select centralbase.timingCrateTableRunTime(#{endDate},#{startDate});
|
|
70
|
+ </select>
|
|
71
|
+ <select id="testRuntime">
|
|
72
|
+ SELECT count(1) FROM centralbase.cb_temp_well_mech_runtime
|
|
73
|
+ WHERE prod_date = #{p1}
|
|
74
|
+ </select>
|
|
75
|
+</mapper>
|