|
@@ -0,0 +1,114 @@
|
|
|
+<?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.victorysoft.business.calc.dao.WellSectionDailyReallyDao">
|
|
|
+
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ WELLNAME, RECORD_DATE, "SECTION", UNITCODE, WELL_TYPE, NOZZLE, PP, PC, PT, PLAN_DAILY_WATER,
|
|
|
+ DAILY_WATER, WATER_WELL_CLASSIFY, INJECT_TYPE, OPEN_TIME, REMARK_CODE, REMARK_CODE1, LAYER, INJECT_TYPE_YS,
|
|
|
+ REMARK, PLAN_SECTION
|
|
|
+ </sql>
|
|
|
+
|
|
|
+
|
|
|
+ <insert id="syncSingleWellDaily">
|
|
|
+ insert into well_section_daily
|
|
|
+ (wellname, record_date, unitcode, well_type, section, nozzle, pp, pc, pt,
|
|
|
+ plan_daily_water, daily_water, water_well_classify, inject_type_ys, open_time,
|
|
|
+ remark_code, remark_code1, layer, remark, plan_section, well_water)
|
|
|
+ select b.jh wellname, b.rq record_date, c.dwdm unitcode,
|
|
|
+ case
|
|
|
+ when (c.mqjb is null or c.mqjb not like 'X%') and (b.zsmd is null or b.zsmd not in ('边底水驱','消化污水')) then '1'
|
|
|
+ when c.mqjb like 'X%' and (b.zsmd is null or b.zsmd not in ('边底水驱','消化污水')) then '0'
|
|
|
+ when (c.mqjb is null or c.mqjb not like 'X%') and b.zsmd = '消化污水' then '2'
|
|
|
+ when (c.mqjb is null or c.mqjb not like 'X%') and b.zsmd = '边底水驱' then '3'
|
|
|
+ when c.mqjb like 'X%' and b.zsmd = '消化污水' then '4'
|
|
|
+ when c.mqjb like 'X%' and b.zsmd = '边底水驱' then '5'
|
|
|
+ end well_type,
|
|
|
+ 1 section, null nozzle, b.gxyl pp, b.ty pc, b.yy pt,
|
|
|
+ b.rpzsl plan_daily_water, b.rzsl daily_water,
|
|
|
+ case when b.bz like '%一类井%' then '1'
|
|
|
+ when b.bz like '%二类井%' then '2'
|
|
|
+ when b.bz like '%三类井%' then '3'
|
|
|
+ when b.bz like '%四类井%' then '4' end water_well_classify,
|
|
|
+ b.zsfs inject_type_ys,
|
|
|
+ b.scsj open_time, b.bzdm remark_code, b.bzdm1 remark_code,
|
|
|
+ b.zscw,
|
|
|
+ b.bz,
|
|
|
+ b.pzcds,
|
|
|
+ b.rzsl
|
|
|
+ from ys_dba02 b
|
|
|
+ left join ys_daa01 c on b.jh = c.jh
|
|
|
+ where b.rq >= #{startDate,jdbcType=TIMESTAMP}
|
|
|
+ and b.rq <= #{endDate,jdbcType=TIMESTAMP}
|
|
|
+ and b.zsfs in
|
|
|
+ <foreach collection="injectCodes" item = "code" open="(" separator="," close=")" index="index">
|
|
|
+ #{code}
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="syncWellSectionDaily">
|
|
|
+ insert into well_section_daily
|
|
|
+ (wellname, record_date, unitcode, well_type, section, nozzle, pp, pc, pt,
|
|
|
+ plan_daily_water, daily_water, water_well_classify, inject_type_ys, open_time,
|
|
|
+ remark_code, remark_code1, layer, remark, plan_section, well_water)
|
|
|
+ select a.jh wellname, a.rq record_date, c.dwdm unitcode,
|
|
|
+ case
|
|
|
+ when (c.mqjb is null or c.mqjb not like 'X%') and (b.zsmd is null or b.zsmd not in ('边底水驱','消化污水')) then '1'
|
|
|
+ when c.mqjb like 'X%' and (b.zsmd is null or b.zsmd not in ('边底水驱','消化污水')) then '0'
|
|
|
+ when (c.mqjb is null or c.mqjb not like 'X%') and b.zsmd = '消化污水' then '2'
|
|
|
+ when (c.mqjb is null or c.mqjb not like 'X%') and b.zsmd = '边底水驱' then '3'
|
|
|
+ when c.mqjb like 'X%' and b.zsmd = '消化污水' then '4'
|
|
|
+ when c.mqjb like 'X%' and b.zsmd = '边底水驱' then '5'
|
|
|
+ end well_type,
|
|
|
+ a.cdxh section, a.cdsz nozzle, b.gxyl pp, b.ty pc, b.yy pt,
|
|
|
+ a.cdrpsl plan_daily_water, a.cdrzsl daily_water,
|
|
|
+ case when b.bz like '%一类井%' then '1'
|
|
|
+ when b.bz like '%二类井%' then '2'
|
|
|
+ when b.bz like '%三类井%' then '3'
|
|
|
+ when b.bz like '%四类井%' then '4' end water_well_classify,
|
|
|
+ b.zsfs inject_type_ys,
|
|
|
+ b.scsj open_time, b.bzdm remark_code, b.bzdm1 remark_code,
|
|
|
+ a.zscw,
|
|
|
+ b.bz,
|
|
|
+ b.pzcds,
|
|
|
+ b.rzsl
|
|
|
+ from dba021 a
|
|
|
+ inner join ys_dba02 b on a.jh = b.jh and a.rq = b.rq
|
|
|
+ left join ys_daa01 c on a.jh = c.jh
|
|
|
+ where a.rq >= #{startDate,jdbcType=TIMESTAMP}
|
|
|
+ and a.rq <= #{endDate,jdbcType=TIMESTAMP}
|
|
|
+ and b.zsfs in
|
|
|
+ <foreach collection="injectCodes" item = "code" open="(" separator="," close=")" index="index">
|
|
|
+ #{code}
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateInjectType">
|
|
|
+ merge into WELL_SECTION_DAILY t using
|
|
|
+ <foreach collection="list" item="item" open="(" close=")" index="index" separator="union all" >
|
|
|
+ select
|
|
|
+ #{item.wellname} WELLNAME, #{item.recordDate} RECORD_DATE,
|
|
|
+ #{item.section} "SECTION", #{item.injectType} INJECT_TYPE
|
|
|
+ from dual
|
|
|
+ </foreach>
|
|
|
+ tmp on (tmp.WELLNAME = t.WELLNAME and tmp.RECORD_DATE = t.RECORD_DATE and tmp."SECTION" = t."SECTION")
|
|
|
+ when matched then
|
|
|
+ update set t.INJECT_TYPE = tmp.INJECT_TYPE
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="deleteByDate">
|
|
|
+ DELETE FROM WELL_SECTION_DAILY WHERE RECORD_DATE >= #{startDate, jdbcType=TIMESTAMP} AND RECORD_DATE <= #{endDate, jdbcType=TIMESTAMP}
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="selectInjectTechnology" resultType="cn.com.victorysoft.business.calc.entity.SysInjectTechnology">
|
|
|
+ SELECT DM, LB, DMMC, ZSGY, TXSG, FTPD FROM SYS_INJECT_TECHNOLOGY
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectByDate" resultType="cn.com.victorysoft.business.sys.entity.WellSectionDaily">
|
|
|
+ select
|
|
|
+ <include refid="Base_Column_List" />
|
|
|
+ from WELL_SECTION_DAILY
|
|
|
+ where RECORD_DATE >= TO_DATE(#{startDate}, 'yyyy-mm-dd')
|
|
|
+ and RECORD_DATE <= TO_DATE(#{endDate}, 'yyyy-mm-dd')
|
|
|
+ order by WELLNAME, "SECTION", RECORD_DATE
|
|
|
+ </select>
|
|
|
+</mapper>
|