<?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.RecordManageMapper">

  <resultMap id="recordManageMap" type="com.lutao.entity.RecordManage">
                  <id property="id" column="id"/>
                        <result property="originId" column="origin_id"/>
                        <result property="facilityName" column="facility_name"/>
                        <result property="filingCode" column="filing_code"/>
                        <result property="filingTime" column="filing_time"/>
                        <result property="filingFile" column="filing_file"/>
                        <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="getRecordManageList" resultType="com.lutao.cloud.oil.pojo.vo.RecordManageVO">
        SELECT
            rm.id,
            rm.facility_name,
            rm.filing_code,
            rm.filing_time,
            rm.filing_file,
            rm.app_id,
            rm.platform_code,
            pi.platform_name,
            pi.oil_gas_name,
            pi.operating_company,
            ai.app_name
        FROM
            record_manage rm
            LEFT JOIN platform_info pi ON rm.platform_code = pi.platform_code
            LEFT JOIN app_info ai ON rm.app_id = ai.id
        <where>
            pi.delete_flag = '0'
            <if test="param.platformId != null and param.platformId != ''">
                AND rm.platform_code = #{param.platformId}
            </if>
            <if test="param.appId != null and param.appId != ''">
                AND rm.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.filingTime != null">
                AND rm.filing_time = #{param.filingTime}
            </if>
        </where>
        ORDER BY rm.filing_time desc
    </select>
</mapper>
