<?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.GcBidcandidatePostMapper">
    <select id="queryGcBidcandidatePostList" resultType="com.trs.ggzyexchange.entity.GcBidcandidatePostVo">
        select
            gcbp.SOURCE_DATA_KEY sourceDataKey,
            gcp.PROJECT_CODE projectCode,
            gct.REGION_CODE projectCode,
            gcbp.TENDER_PROJECT_CODE tenderProjectCode,
            gcbp.PUBLICITY_NAME publicityName,
            gcbp.PLATFORM_CODE platformCode,
            gcbp.INDUSTRIES_TYPE industriesType,
            gcbp.PUBLICITY_REFER_TIME publicityReferTime,
            gcbp.PUBLICITY_START_TIME publicityStartTime,
            gcbp.PUBLICITY_END_TIME publicityEndTime,
            gct.REGION_CODE regionCode
        from
            GC_BIDCANDIDATE_POST gcbp
            left join GC_TENDERPROJECT gct
            on gct.TENDER_PROJECT_CODE = gcbp.TENDER_PROJECT_CODE
            left join GC_PROJECT gcp
        on gct.PROJECT_CODE = gcp.PROJECT_CODE
        <where>
            <if test="regionCode != null and regionCode != ''">
                and gct.REGION_CODE = #{regionCode}
            </if>
            <if test="platformCode != null and platformCode != ''">
                and gcbp.PLATFORM_CODE = #{platformCode}
            </if>
            <if test="industriesType != null and industriesType != ''">
                and gcbp.INDUSTRIES_TYPE = #{industriesType}
            </if>
            <if test="publicityReferTimeStart != null and publicityReferTimeStart != ''">
                and gcbp.PUBLICITY_START_TIME &gt;= #{publicityReferTimeStart}
            </if>
            <if test="publicityReferTimeEnd != null and publicityReferTimeEnd != ''">
                and gcbp.PUBLICITY_START_TIME &lt;= #{publicityReferTimeEnd}
            </if>
            <if test="publicityName != null and publicityName != ''">
                <bind name="publicityName" value="'%'+publicityName+'%'"/>
                and gcbp.PUBLICITY_NAME like #{publicityName}
            </if>
        </where>
        order by gcbp.PUBLICITY_REFER_TIME desc
    </select>

    <select id="queryGcBidcandidatePostAllList" resultType="com.trs.ggzyexchange.entity.TenderDetailsVo">
        select
            gcbp.SOURCE_DATA_KEY sourceDataKey,
            gcp.PROJECT_CODE projectCode,
            gcp.PROJECT_NAME projectName,
            gcbp.TENDER_PROJECT_CODE tenderProjectCode,
            gcbp.PUBLICITY_NAME noticeName,
            gcbp.PUBLICITY_CONTENT noticeContent,
            gcbp.PUBLICITY_REFER_TIME noticeSendTime,
            gcbp.PUBLICITY_TYPE noticeNature,
            gcp.REGION_CODE regionCode,
            gcbp.INDUSTRIES_TYPE industriesTypeCode,
            gcbp.PLATFORM_CODE platformCode,
            gcbp.BULLETIN_DUTY bulletinDuty,
            gcbp.DATA_SOURCE_CODE dataSourceCode,
            gcbp.BID_SECTION_CODES bidSectionCodes,
            gcbp.PUBLICITY_START_TIME docGetStartTime,
            gcbp.PUBLICITY_END_TIME docGetEndTime
        from
            GC_BIDCANDIDATE_POST gcbp
        left join GC_TENDERPROJECT gct
            on gct.TENDER_PROJECT_CODE = gcbp.TENDER_PROJECT_CODE
        left join GC_PROJECT gcp
            on gct.PROJECT_CODE = gcp.PROJECT_CODE
    </select>
    <select id="queryGcBidcandidatePostAllListByTime" resultType="com.trs.ggzyexchange.entity.TenderDetailsVo">
        select
            gcbp.SOURCE_DATA_KEY sourceDataKey,
            gcp.PROJECT_CODE projectCode,
            gcp.PROJECT_NAME projectName,
            gcbp.TENDER_PROJECT_CODE tenderProjectCode,
            gcbp.PUBLICITY_NAME noticeName,
            gcbp.PUBLICITY_CONTENT noticeContent,
            gcbp.PUBLICITY_REFER_TIME noticeSendTime,
            gcbp.PUBLICITY_TYPE noticeNature,
            gcp.REGION_CODE regionCode,
            gcbp.INDUSTRIES_TYPE industriesTypeCode,
            gcbp.PLATFORM_CODE platformCode,
            gcbp.BULLETIN_DUTY bulletinDuty,
            gcbp.DATA_SOURCE_CODE dataSourceCode,
            gcbp.BID_SECTION_CODES bidSectionCodes,
            gcbp.PUBLICITY_START_TIME docGetStartTime,
            gcbp.PUBLICITY_END_TIME docGetEndTime
        from
            GC_BIDCANDIDATE_POST gcbp
                left join GC_TENDERPROJECT gct
                          on gct.TENDER_PROJECT_CODE = gcbp.TENDER_PROJECT_CODE
                left join GC_PROJECT gcp
                          on gct.PROJECT_CODE = gcp.PROJECT_CODE
        where gcbp.DATA_TIMESTAMP &gt; #{time}
    </select>
    <select id="maxDataTimeStamp" resultType="java.lang.Long">
        select max(DATA_TIMESTAMP) from "ggzyexchange"."GC_BIDCANDIDATE_POST";
    </select>

</mapper>
