123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347 |
- <?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.WellInfoCQuery">
- <select id="getWellInfo" resultType="java.util.HashMap">
- select
- well.*,
- TO_CHAR(well.create_date , 'YYYY-MM-dd') create_date_fmt,
- TO_CHAR(well.update_date , 'YYYY-MM-dd') update_date_fmt,
- TO_CHAR(well.spud_date , 'YYYY-MM-dd') spud_date_fmt,TO_CHAR(well.end_drilling_date , 'YYYY-MM-dd') end_drilling_date_fmt,
- fact_daily.fluid_prod_daily,
- fact_daily.oil_prod_daily,
- fact_daily.water_cut,
- fact_daily.oil_prod_cum,
- TO_CHAR(fact_intr.start_prod_date , 'YYYY-MM-dd') start_prod_date,
- fact_intr.prod_horizon,
- TO_CHAR(fact_intr.recent_testing_date , 'YYYY-MM-dd') recent_testing_date,
- fact_intr.recent_testing_name,
- fact_intr.construction_description,
- TO_CHAR(fact_intr.recent_prod_date , 'YYYY-MM-dd') recent_prod_date,
- fact_intr.oil_nozzle,
- fact_intr.tubing_pres,
- fact_intr.casing_pres,
- fact_intr.start_pump_liq_level,
- str.well_production_sections,
- str.t74_top_depth,
- str.ko_azimuth,
- str.ko_horizontal_dislocation,
- str.azimuth_angle,
- str.well_coordinates_x,
- str.well_coordinates_y,
- intr.well_state
- from by_dwr.fact_dwr_well_basic_information well
- left join by_dwr.fact_dwr_well_structure str on well.well_id = str.well_id
- left join by_dwr.fact_dwr_well_history_introduction intr on well.well_id=intr.well_id
- left join (
- select daily.*
- from by_dwr.fact_dwr_pc_pro_well_vol_d daily
- inner join(
- select well_id, max(prod_date) prod_date from by_dwr.fact_dwr_pc_pro_well_vol_d group by well_id
- ) maxdaily on daily.well_id = maxdaily.well_id and daily.prod_date = maxdaily.prod_date
- ) fact_daily on well.well_id = fact_daily.well_id
- left join (
- select intr.*
- from by_dwr.fact_dwr_well_history_introduction intr
- inner join(
- select well_id, max(start_prod_date) start_prod_date
- from by_dwr.fact_dwr_well_history_introduction
- group by well_id
- ) maxintr on intr.well_id = maxintr.well_id and intr.start_prod_date = maxintr.start_prod_date
- ) fact_intr on well.well_id = fact_intr.well_id
- where well.well_id = #{well_id}
- </select>
- <select id="getWellInfoList" parameterType="com.bowintek.practice.vo.query.WellInfoParams"
- resultType="java.util.HashMap">
- select
- well.well_id, well.well_common_name, well_purpose, well.well_type, well.end_drilling_date, well.budgeted_md, well.completion_formation,
- well.completion_method, well.org_id_a1, well.org_id_a2, well.org_name_a2,well.project_id, well.project_name,
- TO_CHAR(well.spud_date , 'YYYY-MM-dd') spud_date,TO_CHAR(well.end_drilling_date , 'YYYY-MM-dd') end_drilling_date,TO_CHAR(well.completion_date , 'YYYY-MM-dd') completion_date,
- station.name org_name_a1,
- TO_CHAR(fact_daily.oil_prod_begin_date , 'YYYY-MM-dd') oil_prod_begin_date,
- TO_CHAR(fact_daily.oil_prod_recent_date , 'YYYY-MM-dd') oil_prod_recent_date,
- fact_daily.current_state,fact_daily.water_cut,fact_daily.oil_prod_cum oil_prod_year,
- fact_daily.gas_prod_cum gas_prod_year,
- fact_daily.inj_vol_cum water_prod_year,
- fact_mon.oil_prod_mon,fact_mon.gas_prod_mon,fact_mon.inj_vol_mon water_prod_mon,
- well_stt.well_coordinates_x x,
- well_stt.well_coordinates_y y,
- intr.well_state
- from by_dwr.fact_dwr_well_basic_information well
- left join by_dwr.fact_dwr_well_history_introduction intr on well.well_id=intr.well_id
- left join (
- select daily.* from by_dwr.fact_dwr_pc_pro_well_vol_d daily
- inner join(
- select well_id, max(prod_date) prod_date from by_dwr.fact_dwr_pc_pro_well_vol_d group by well_id
- ) maxdaily on daily.well_id=maxdaily.well_id and daily.prod_date=maxdaily.prod_date
- )fact_daily on well.well_id= fact_daily.well_id
- left join (
- select mon.* from by_dwr.fact_dwr_pc_pro_well_vol_m mon
- inner join(
- select well_id, max(prod_date) prod_date from by_dwr.fact_dwr_pc_pro_well_vol_m group by well_id
- ) maxmon on mon.well_id=maxmon.well_id and mon.prod_date=maxmon.prod_date
- )fact_mon on well.well_id= fact_mon.well_id
- left join by_dwr.fact_dwr_well_structure well_stt on well.well_id = well_stt.well_id
- left join by_dim.v_plant_site_station station on well.org_id_a1=station.id
- where 1=1
- <if test="well_common_name!='' and well_common_name!=null">
- and well.well_common_name like Concat('%',#{well_common_name},'%')
- </if>
- <if test="well_id!='' and well_id!=null">
- and well.well_id like Concat('%',#{well_id},'%')
- </if>
- <if test="well_type!='' and well_type!=null">
- and well.well_type like Concat('%',#{well_type},'%')
- </if>
- <if test="well_purpose!='' and well_purpose!=null">
- and well.well_purpose like Concat('%',#{well_purpose},'%')
- </if>
- <if test="spud_date_begin!='' and spud_date_begin!=null">
- and well.spud_date <![CDATA[ >= ]]> CAST(#{spud_date_begin} AS DATE)
- </if>
- <if test="spud_date_end!='' and spud_date_end!=null">
- and well.spud_date <![CDATA[ < ]]> (CAST(#{spud_date_end} AS DATE) + INTERVAL '1 day')
- </if>
- <if test="completion_date_begin!='' and completion_date_begin!=null">
- and well.completion_date <![CDATA[ >= ]]> CAST(#{completion_date_begin} AS DATE)
- </if>
- <if test="completion_date_end!='' and completion_date_end!=null">
- and well.completion_date <![CDATA[ < ]]> (CAST(#{completion_date_end} AS DATE) + INTERVAL '1 day')
- </if>
- <if test="oil_prod_begin_date_begin!='' and oil_prod_begin_date_begin!=null">
- and fact_daily.oil_prod_begin_date <![CDATA[ >= ]]> CAST(#{oil_prod_begin_date_begin} AS DATE)
- </if>
- <if test="oil_prod_begin_date_end!='' and oil_prod_begin_date_end!=null">
- and fact_daily.oil_prod_begin_date <![CDATA[ < ]]> (CAST(#{oil_prod_begin_date_end} AS DATE) + INTERVAL '1
- day')
- </if>
- <if test="oil_prod_recent_date_begin!='' and oil_prod_recent_date_begin!=null">
- and fact_daily.oil_prod_recent_date <![CDATA[ >= ]]> CAST(#{oil_prod_recent_date_begin} AS DATE)
- </if>
- <if test="oil_prod_recent_date_end!='' and oil_prod_recent_date_end!=null">
- and fact_daily.oil_prod_recent_date <![CDATA[ < ]]> (CAST(#{oil_prod_recent_date_end} AS DATE) + INTERVAL
- '1 day')
- </if>
- <if test="org_id_a1!='' and org_id_a1!=null">
- and well.org_id_a1 =#{org_id_a1}
- </if>
- <if test="project_id!='' and project_id!=null">
- and well.project_id =#{project_id}
- </if>
- <if test="orgList!=null and orgList.size>0">
- and well.org_id_a1 in
- <foreach collection="orgList" item="orgId" index="index" open="(" close=")" separator=",">
- #{orgId}
- </foreach>
- </if>
- <if test="unitList!=null and unitList.size>0">
- and well.project_id in
- <foreach collection="unitList" item="unitId" index="index" open="(" close=")" separator=",">
- #{unitId}
- </foreach>
- </if>
- order by well.well_common_name
- </select>
- <select id="getWellMapList" parameterType="com.bowintek.practice.vo.query.WellInfoParams"
- resultType="java.util.HashMap">
- SELECT well.well_id,
- well.well_common_name,
- well.geo_description,
- structure.well_coordinates_x x,
- structure.well_coordinates_y y
- FROM by_dwr.fact_dwr_well_basic_information well
- inner join by_dwr.fact_dwr_well_structure structure on well.well_id = structure.well_id
- where 1=1
- <if test="well_common_name!='' and well_common_name!=null">
- and well.well_common_name like Concat('%',#{well_common_name},'%')
- </if>
- <if test="well_id!='' and well_id!=null">
- and well.well_id like Concat('%',#{well_id},'%')
- </if>
- <if test="well_type!='' and well_type!=null">
- and well.well_type like Concat('%',#{well_type},'%')
- </if>
- <if test="spud_date_begin!='' and spud_date_begin!=null">
- and well.spud_date <![CDATA[ >= ]]> CAST(#{spud_date_begin} AS DATE)
- </if>
- <if test="spud_date_end!='' and spud_date_end!=null">
- and well.spud_date <![CDATA[ < ]]> (CAST(#{spud_date_end} AS DATE) + INTERVAL '1 day')
- </if>
- <if test="completion_date_begin!='' and completion_date_begin!=null">
- and well.completion_date <![CDATA[ >= ]]> CAST(#{completion_date_begin} AS DATE)
- </if>
- <if test="completion_date_end!='' and completion_date_end!=null">
- and well.completion_date <![CDATA[ < ]]> (CAST(#{completion_date_end} AS DATE) + INTERVAL '1 day')
- </if>
- <if test="org_id_a1!='' and org_id_a1!=null">
- and well.org_id_a1 =#{org_id_a1}
- </if>
- <if test="project_id!='' and project_id!=null">
- and well.project_id =#{project_id}
- </if>
- order by well.well_common_name
- </select>
- <select id="selectBoreholeInterList" resultType="java.util.HashMap">
- select
- bi.interp_borehole_id,
- bi.interp_id,
- bi.well_id,
- bi.wellbore_id,
- bi.zone_id,
- bi.zone_no,
- bi.borehole_inter_type,
- bi.start_depth,
- bi.end_depth,
- bi.thickness,
- bi.lithology_class,
- bi.spontaneous_potential,
- bi.sp_gamma_radiant_intensity,
- bi.well_diameter,
- bi.formation_volume_density,
- bi.sonic_differential_time,
- bi.compensated_neutron,
- bi.laterolog_shallow,
- bi.laterolog_deep,
- bi.laterolog_flushed_zone,
- bi.density_porosity,
- bi.sonic_porosity,
- bi.neutron_porosity,
- bi.effective_porosity,
- bi.total_porosity,
- bi.permeability,
- bi.oil_gas_saturation,
- bi.irreducible_water_saturation,
- bi.shale_content,
- bi.sandy_content,
- bi.lime_content,
- bi.dolomitic_content,
- bi.carbonate_content,
- bi.idx_type,
- case when bi.interpretation_result like 'c%' then ''
- else bi.interpretation_result
- end interpretation_result,
- bi.start_tvd,
- bi.end_tvd,
- bi.tvd_thickness,
- bi.remarks,
- TO_CHAR(bi.create_date , 'YYYY-MM-dd') create_date,
- bi.create_user_id,
- bi.create_app_id,
- TO_CHAR(bi.update_date , 'YYYY-MM-dd') update_date,
- bi.update_user_id,
- bi.check_date,
- bi.check_user_id,
- bi.unify_task_id,
- bi.source
- from by_dwr.fact_dwr_wl_ach_borehole_inter bi
- where bi.well_id = 'HBe6JDZ9rt'
- order by zone_no asc
- </select>
- <select id="selectTestHistoryList" resultType="java.util.HashMap">
- select *
- from by_dm.dws_dm_test_history th
- where th.well_id = #{well_id}
- order by testing_date desc
- limit 100
- </select>
- <select id="selectTestHistorySummary" resultType="java.util.HashMap">
- select testing_name, count(1) as testing_num
- from by_dm.dws_dm_test_history th
- where th.well_id = #{well_id}
- group by th.testing_name
- </select>
- <select id="getLastTestHistory" resultType="java.util.HashMap">
- select *
- from by_dm.dws_dm_test_history th
- where th.well_id = #{well_id}
- order by th.testing_date desc limit 1
- </select>
- <select id="selectAnalyticalAssaysList" resultType="java.util.HashMap">
- select *
- from by_dm.dws_dm_analytical_assays_new aa
- where aa.well_id = #{well_id}
- order by item_code
- limit 100
- </select>
- <select id="selectAnalyticalAssaysSummary" resultType="java.util.HashMap">
- SELECT item_code,
- SUM(CASE WHEN item_code = '井裸眼井基本解释成果' THEN 1 ELSE 0 END) AS 井裸眼井基本解释成果,
- SUM(CASE WHEN item_code = '岩石力学参数解释成果' THEN 1 ELSE 0 END) AS 岩石力学参数解释成果,
- SUM(CASE WHEN item_code = '储层孔隙结构评价' THEN 1 ELSE 0 END) AS 储层孔隙结构评价,
- SUM(CASE WHEN item_code = '裂缝型地层测井解释成果' THEN 1 ELSE 0 END) AS 裂缝型地层测井解释成果,
- SUM(CASE WHEN item_code = '煤层气测井解释成果' THEN 1 ELSE 0 END) AS 煤层气测井解释成果,
- SUM(CASE WHEN item_code = '录井综合解释' THEN 1 ELSE 0 END) AS 录井综合解释,
- SUM(CASE WHEN item_code = '气测解释' THEN 1 ELSE 0 END) AS 气测解释,
- SUM(CASE WHEN item_code = '定量荧光解释' THEN 1 ELSE 0 END) AS 定量荧光解释
- FROM by_dm.dws_dm_analytical_assays_new
- where well_id = #{well_id}
- GROUP BY item_code;
- </select>
- <select id="selectHistoryAssignmentList" resultType="java.util.HashMap">
- select well_common_name, well_id, wellbore_id, event_id, test_id, TO_CHAR(start_time , 'YYYY-MM-dd') start_time,TO_CHAR(end_time , 'YYYY-MM-dd') end_time , constr_description, remarks, well_production_sections, formation_name, top_md, btm_md, thickness, layer_no,
- working_type, test_processes_name, worksummary, construct_no, work_team, pump_depth
- from by_dwr.fact_dwr_brief_history_assignment ha
- where ha.well_id = #{well_id}
- order by start_time desc
- </select>
- <select id="selectHistoryAssignmentSummary" resultType="java.util.HashMap">
- select test_processes_name, count(1) as testing_num
- from by_dwr.fact_dwr_brief_history_assignment bha
- where bha.well_id = #{well_id}
- group by bha.test_processes_name
- </select>
- <select id="getLastHistoryAssignment" resultType="java.util.HashMap">
- select
- well_common_name, well_id, wellbore_id, event_id, test_id, TO_CHAR(start_time , 'YYYY-MM-dd') start_time,TO_CHAR(end_time , 'YYYY-MM-dd') end_time , constr_description, remarks, well_production_sections, formation_name, top_md, btm_md, thickness, layer_no,
- working_type, test_processes_name, worksummary, construct_no, work_team, pump_depth
- from by_dwr.fact_dwr_brief_history_assignment bha
- where bha.well_id = #{well_id}
- order by bha.start_time desc limit 1
- </select>
- <select id="selectDataIndexList" resultType="java.util.HashMap">
- select di.*,well.well_id
- from by_dwr.fact_dwr_well_data_index di
- inner join by_dwr.fact_dwr_well_basic_information well on di.well_common_name=well.well_common_name
- where well.well_id = #{well_id}
- </select>
- <select id="selectDimProjectTypeList" resultType="java.util.HashMap">
- select name as title,value_id as key
- from BY_DIM.dim_project_type
- where is_effect = 1
- </select>
- <select id="selectConstructUnitList" resultType="java.util.HashMap">
- select lv.*,
- desc1.name as project_name_1,
- desc2.name as project_name_2,
- desc3.name as project_name_3,
- desc4.name as project_name_4,
- desc5.name as project_name_5
- from BY_DIM.dim_construct_unit_level lv
- left join BY_DIM.dim_construct_unit_desc desc1 on lv.project_id_1 = desc1.id
- left join BY_DIM.dim_construct_unit_desc desc2 on lv.project_id_2 = desc2.id
- left join BY_DIM.dim_construct_unit_desc desc3 on lv.project_id_3 = desc3.id
- left join BY_DIM.dim_construct_unit_desc desc4 on lv.project_id_4 = desc4.id
- left join BY_DIM.dim_construct_unit_desc desc5 on lv.project_id_5 = desc5.id
- where lv.is_effect = 1
- </select>
- <select id="selectOilgasUnitList" resultType="java.util.HashMap">
- select lv.*, desc1.name as project_name_1,
- desc2.name as project_name_2,
- desc3.name as project_name_3,
- desc4.name as project_name_4,
- desc5.name as project_name_5,
- desc6.name as project_name_6,
- desc7.name as project_name_7
- from BY_DIM.dim_oilgas_unit_level lv
- left join BY_DIM.dim_oilgas_unit_desc desc1 on lv.project_id_1 = desc1.id
- left join BY_DIM.dim_oilgas_unit_desc desc2 on lv.project_id_2 = desc2.id
- left join BY_DIM.dim_oilgas_unit_desc desc3 on lv.project_id_3 = desc3.id
- left join BY_DIM.dim_oilgas_unit_desc desc4 on lv.project_id_4 = desc4.id
- left join BY_DIM.dim_oilgas_unit_desc desc5 on lv.project_id_5 = desc5.id
- left join BY_DIM.dim_oilgas_unit_desc desc6 on lv.project_id_6 = desc6.id
- left join BY_DIM.dim_oilgas_unit_desc desc7 on lv.project_id_7 = desc7.id
- where lv.is_effect = 1
- </select>
- </mapper>
|