<?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.lutao.cloud.oil.mapper.GiveupMineReportMapper">

  <resultMap id="giveupMineReportMap" type="com.lutao.entity.GiveupMineReport">
                  <id property="id" column="id"/>
                        <result property="originId" column="origin_id"/>
                        <result property="wellCode" column="well_code"/>
                        <result property="submitTime" column="submit_time"/>
                        <result property="submitReport" column="submit_report"/>
                        <result property="completeTime" column="complete_time"/>
                        <result property="completeReprot" column="complete_reprot"/>
                        <result property="reportPerson" column="report_person"/>
                        <result property="pfId" column="pf_id"/>
                        <result property="appId" column="app_id"/>
                        <result property="platformCode" column="platform_code"/>
                        <result property="platformName" column="platform_name"/>
                        <result property="platformId" column="platform_id"/>
                        <result property="createDate" column="create_date"/>
                        <result property="createBy" column="create_by"/>
                        <result property="updateDate" column="update_date"/>
                        <result property="updateBy" column="update_by"/>
            </resultMap>
    <select id="getGiveupMineReportList" resultType="com.lutao.cloud.oil.pojo.vo.GiveupMineReportVO">
        SELECT
            gmr.id,
            gmr.well_code,
            gmr.submit_time,
            gmr.submit_report,
            gmr.complete_time,
            gmr.complete_reprot,
            gmr.report_person,
            gmr.app_id,
            gmr.platform_code,
            pi.platform_name,
            pi.oil_gas_name,
            pi.operating_company,
            ai.app_name
        FROM
            giveup_mine_report gmr
            LEFT JOIN platform_info pi ON gmr.platform_code = pi.platform_code
            LEFT JOIN app_info ai ON gmr.app_id = ai.id
        <where>
            pi.delete_flag = '0'
            <if test="param.platformId != null and param.platformId != ''">
                AND gmr.platform_code = #{param.platformId}
            </if>
            <if test="param.appId != null and param.appId != ''">
                AND gmr.app_id = #{param.appId}
            </if>
            <if test="param.operatingCompany != null and param.operatingCompany != ''">
                AND pi.operating_company = #{param.operatingCompany}
            </if>
            <if test="param.oilGasName != null and param.oilGasName != ''">
                AND pi.oil_gas_name = #{param.oilGasName}
            </if>
            <if test="param.completeTime != null">
                gmr.complete_time = #{param.completeTime}
            </if>
        </where>
        order by gmr.complete_time desc
    </select>
</mapper>
