<?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.trs.ggzyexchange.mapper.GcBidopenrecordMapper">

    <select id="queryGcBidopenrecordServiceList" resultType="com.trs.ggzyexchange.entity.GcBidopenrecordVo">
        select
            gcb.SOURCE_DATA_KEY sourceDataKey,
            gcp.PROJECT_CODE projectCode,
            gcb.TENDER_PROJECT_CODE tenderProjectCode,
            gcb.NOTICE_NAME noticeName,
            gcb.PLATFORM_CODE platformCode,
            gcb.BID_OPENING_ADDRESS bidOpeningAddress,
            gcb.BID_OPENING_TIME bidOpeningTime,
            gcb.BID_FINISH_TIME bidFinishTime,
            gct.REGION_CODE regionCode,
            gcb.DATA_SOURCE_CODE dataSourceCode,
            gcp.INDUSTRIES_TYPE industriesTypeW
        from
            GC_BIDOPENRECORD gcb
            left join GC_TENDERPROJECT gct
            on gcb.TENDER_PROJECT_CODE = gct.TENDER_PROJECT_CODE
            left join GC_PROJECT gcp
            on gct.PROJECT_CODE = gcp.PROJECT_CODE
        <where>
            <if test="regionCode != null and regionCode != ''">
                and gcp.REGION_CODE = #{regionCode}
            </if>
            <if test="platformCode != null and platformCode != ''">
                and gcp.PLATFORM_CODE = #{platformCode}
            </if>
            <if test="industriesType != null and industriesType != ''">
                and gcp.INDUSTRIES_TYPE = #{industriesType}
            </if>
            <if test="bidOpeningTimeStart != null and bidOpeningTimeStart != ''">
                and gcb.BID_OPENING_TIME &gt;= #{bidOpeningTimeStart}
            </if>
            <if test="bidOpeningTimeEnd != null and bidOpeningTimeEnd != ''">
                and gcb.BID_OPENING_TIME &lt;= #{bidOpeningTimeEnd}
            </if>
            <if test="bidFinishTimeStart != null and bidFinishTimeStart != ''">
                and gcb.BID_FINISH_TIME &gt;= #{bidFinishTimeStart}
            </if>
            <if test="bidFinishTimeEnd != null and bidFinishTimeEnd != ''">
                and gcb.BID_FINISH_TIME &lt;= #{bidFinishTimeEnd}
            </if>
            <if test="noticeName != null and noticeName != ''">
                <bind name="noticeName" value="'%'+noticeName+'%'"/>
                and gcb.NOTICE_NAME like #{noticeName}
            </if>
        </where>
        order by gcb.BID_OPENING_TIME desc
    </select>


    <select id="queryGcBidopenrecordAllList" resultType="com.trs.ggzyexchange.entity.TenderDetailsVo">
        select
            gcb.SOURCE_DATA_KEY sourceDataKey,
            gcp.PROJECT_CODE projectCode,
            gcp.PROJECT_NAME projectName,
            gcb.TENDER_PROJECT_CODE tenderProjectCode,
            gcb.NOTICE_NAME noticeName,
            gcb.BID_OPENING_CONTENT noticeContent,
            gct.CREATE_TIME noticeSendTime,
            gcb.BID_OPENING_TIME bidOpeningTime,
            gcb.BID_FINISH_TIME bidFinishTime,
            gct.REGION_CODE regionCode,
            gcp.INDUSTRIES_TYPE industriesTypeCode,
            gcb.PLATFORM_CODE platformCode,
            gcb.DATA_SOURCE_CODE dataSourceCode,
            gcb.BID_SECTION_CODES bidSectionCodes
        from
            GC_BIDOPENRECORD gcb
                left join GC_TENDERPROJECT gct
                          on gct.TENDER_PROJECT_CODE = gcb.TENDER_PROJECT_CODE
                left join GC_PROJECT gcp
                          on gct.PROJECT_CODE = gcp.PROJECT_CODE
    </select>
    <select id="maxDataTimeStamp" resultType="java.lang.Long">
        select max(DATA_TIMESTAMP) from "ggzyexchange"."GC_BIDOPENRECORD";
    </select>
    <select id="queryGcBidopenrecordAllListByTime" resultType="com.trs.ggzyexchange.entity.TenderDetailsVo">
        select
            gcb.SOURCE_DATA_KEY sourceDataKey,
            gcp.PROJECT_CODE projectCode,
            gcp.PROJECT_NAME projectName,
            gcb.TENDER_PROJECT_CODE tenderProjectCode,
            gcb.NOTICE_NAME noticeName,
            gcb.BID_OPENING_CONTENT noticeContent,
            gct.CREATE_TIME noticeSendTime,
            gcb.BID_OPENING_TIME bidOpeningTime,
            gcb.BID_FINISH_TIME bidFinishTime,
            gct.REGION_CODE regionCode,
            gcp.INDUSTRIES_TYPE industriesTypeCode,
            gcb.PLATFORM_CODE platformCode,
            gcb.DATA_SOURCE_CODE dataSourceCode,
            gcb.BID_SECTION_CODES bidSectionCodes
        from
            GC_BIDOPENRECORD gcb
                left join GC_TENDERPROJECT gct
                          on gct.TENDER_PROJECT_CODE = gcb.TENDER_PROJECT_CODE
                left join GC_PROJECT gcp
                          on gct.PROJECT_CODE = gcp.PROJECT_CODE
        where gcb.DATA_TIMESTAMP &gt; #{time}
    </select>
</mapper>
