12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- <?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.bowintek.practice.mapper.cquery.FactWellCQuery">
- <select id="getDayGroupList" resultType="com.bowintek.practice.vo.FactWell.FactWellGroupList">
- SELECT t.well_id,
- t.prod_time_str time_str,
- SUM(t.gas_prod_daily) gas,
- SUM(t.oil_prod_daily) oil,
- SUM(t.fluid_prod_daily) fluid,
- SUM(t.water_prod_daily) water,
- SUM(t.water_cut) watercut
- FROM ( SELECT wd.well_id,
- TO_CHAR(wd.prod_date , 'YYYY-MM-DD') prod_time_str,
- COALESCE(wd.gas_prod_daily, 0) gas_prod_daily,
- COALESCE(wd.oil_prod_daily, 0) oil_prod_daily,
- COALESCE(wd.fluid_prod_daily, 0) fluid_prod_daily,
- COALESCE(wd.water_prod_daily, 0) water_prod_daily,
- COALESCE(wd.water_cut, 0) water_cut
- FROM by_dwr.fact_dwr_pc_pro_well_vol_d wd
- WHERE wd.prod_date <![CDATA[ >= ]]> to_date(#{startDay},'YYYY-MM-DD')
- and wd.prod_date <![CDATA[ <= ]]> to_date(#{endDay},'YYYY-MM-DD')
- <if test="wellId!='' and wellId!=null">
- and wd.well_id=#{wellId}
- </if>
- ) t
- GROUP BY t.well_id, t.prod_time_str
- </select>
- <select id="getMonthGroupList" resultType="com.bowintek.practice.vo.FactWell.FactWellGroupList">
- SELECT t.well_id,
- t.prod_time_str time_str,
- MAX(t.gas_prod_mon) gas,
- MAX(t.oil_prod_mon) oil,
- MAX(t.water_prod_mon) water,
- MAX(t.fluid_prod_mon) fluid,
- 0 watercut
- FROM ( SELECT wm.well_id,
- TO_CHAR(wm.prod_date , 'YYYY年MM月') prod_time_str,
- COALESCE(wm.gas_prod_cum, 0) gas_prod_mon,
- COALESCE(wm.oil_prod_cum, 0) oil_prod_mon,
- COALESCE(wm.water_prod_cum, 0) water_prod_mon,
- COALESCE(wm.liquid_prod_cum, 0) fluid_prod_mon
- FROM by_dwr.fact_dwr_pc_pro_well_vol_d wm
- WHERE wm.prod_date is not null
- and wm.prod_date <![CDATA[ >= ]]> to_date(#{startDay},'YYYY-MM-DD')
- and wm.prod_date <![CDATA[ <= ]]> to_date(#{endDay},'YYYY-MM-DD')
- and wm.well_id=#{wellId}
- ) t
- GROUP BY t.well_id, t.prod_time_str
- </select>
- <select id="getYearGroupList" resultType="com.bowintek.practice.vo.FactWell.FactWellGroupList">
- SELECT t.well_id,
- t.prod_time_str time_str,
- SUM(t.gas_prod_mon) gas,
- SUM(t.oil_prod_mon) oil,
- SUM(t.water_prod_mon) water,
- SUM(t.fluid_prod_mon) fluid,
- 0 watercut
- FROM ( SELECT wm.well_id,
- SUBSTRING(prod_date, 1, 4) prod_time_str,
- COALESCE(wm.gas_prod_mon, 0) gas_prod_mon,
- COALESCE(wm.oil_prod_mon, 0) oil_prod_mon,
- COALESCE(wm.water_prod_mon, 0) water_prod_mon,
- COALESCE(wm.fluid_prod_mon, 0) fluid_prod_mon
- FROM by_dwr.fact_dwr_pc_pro_well_vol_m wm
- WHERE wm.prod_date is not null
- and to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD') <![CDATA[ >= ]]> to_date(#{startDay},'YYYY-MM-DD')
- and to_date(CONCAT(wm.prod_date,'-01'), 'YYYY-MM-DD') <![CDATA[ <= ]]> to_date(#{endDay},'YYYY-MM-DD')
- <if test="wellId!='' and wellId!=null">
- and wm.well_id=#{wellId}
- </if>
- ) t
- GROUP BY t.well_id, t.prod_time_str
- </select>
- </mapper>
|