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

    <select id="queryGcTenderProjectList"  resultType="com.trs.ggzyexchange.entity.GcNoticeandfileVo">
        select
            gcn.SOURCE_DATA_KEY sourceDataKey,
            gct.REGION_CODE regionCode,
            gcp.PROJECT_CODE projectCode,
            gcn.TENDER_PROJECT_CODE tenderProjectCode,
            gcn.PLATFORM_CODE platformCode,
            gcn.NOTICE_NAME noticeName,
            gcn.NOTICE_SEND_TIME noticeSendTime,
            gcn.DOC_GET_END_TIME docGetEndTime,
            gcn.BULLETIN_TYPE bulletinType,
            gcp.INDUSTRIES_TYPE industriesType
        from
            GC_NOTICEANDFILE gcn
        left join GC_TENDERPROJECT gct
        on gct.TENDER_PROJECT_CODE = gcn.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 gcn.PLATFORM_CODE =  #{platformCode}
            </if>
            <if test="industriesType != null and industriesType != ''">
                and gcp.INDUSTRIES_TYPE = #{industriesType}
            </if>
            <if test="noticeSendTimeStart != null and noticeSendTimeStart != ''">
                and gcn.NOTICE_SEND_TIME &gt;= #{noticeSendTimeStart}
            </if>
            <if test="noticeSendTimeEnd != null and noticeSendTimeEnd != ''">
                and gcn.NOTICE_SEND_TIME &lt;= #{noticeSendTimeEnd}
            </if>
            <if test="noticeName != null and noticeName != ''">
                <bind name="noticeName" value="'%'+noticeName+'%'"/>
                and gcn.NOTICE_NAME like #{noticeName}
            </if>
        </where>
        order by gcn.NOTICE_SEND_TIME desc
    </select>
    <select id="queryGcTenderProjectAllList" resultType="com.trs.ggzyexchange.entity.TenderDetailsVo">

        select
        gcn.SOURCE_DATA_KEY sourceDataKey,
        gcp.PROJECT_CODE projectCode,
        gcp.PROJECT_NAME projectName,
        gcn.TENDER_PROJECT_CODE tenderProjectCode,
        gcn.NOTICE_NAME noticeName,
        gcn.NOTICE_CONTENT noticeContent,
        gcn.NOTICE_SEND_TIME noticeSendTime,
        gcn.NOTICE_NATURE noticeNature,
        gct.REGION_CODE regionCode,
        gcp.INDUSTRIES_TYPE industriesTypeCode,
        gcn.PLATFORM_CODE platformCode,
        gcn.BULLETIN_TYPE bulletinTypeCode,
        gcn.BULLETIN_DUTY bulletinDuty,
        gcn.DATA_SOURCE_CODE dataSourceCode,
        gcn.NOTICE_BID_NUM noticeBidNum,
        gcn.BID_SECTION_CODES bidSectionCodes,
        gcn.DOC_GET_START_TIME docGetStartTime,
        gcn.DOC_GET_END_TIME docGetEndTime,
        gcn.BID_DOC_REFER_END_TIME bidDocReferEndTime,
        gcn.BID_OPEN_TIME bidOpenTime
        from
        GC_NOTICEANDFILE gcn
        left join GC_TENDERPROJECT gct
        on gct.TENDER_PROJECT_CODE = gcn.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 gcn.PLATFORM_CODE =  #{platformCode}
            </if>
            <if test="industriesType != null and industriesType != ''">
                and gcp.INDUSTRIES_TYPE = #{industriesType}
            </if>
            <if test="noticeSendTimeStart != null and noticeSendTimeStart != ''">
                and gcn.NOTICE_SEND_TIME &gt;= #{noticeSendTimeStart}
            </if>
            <if test="noticeSendTimeEnd != null and noticeSendTimeEnd != ''">
                and gcn.NOTICE_SEND_TIME &lt;= #{noticeSendTimeEnd}
            </if>
            <if test="noticeName != null and noticeName != ''">
                <bind name="noticeName" value="'%'+noticeName+'%'"/>
                and gcn.NOTICE_NAME like #{noticeName}
            </if>
        </where>
    </select>


    <select id="queryGcTenderProjectAllListGeTime" resultType="com.trs.ggzyexchange.entity.TenderDetailsVo">

        select
        gcn.SOURCE_DATA_KEY sourceDataKey,
        gcp.PROJECT_CODE projectCode,
        gcp.PROJECT_NAME projectName,
        gcn.TENDER_PROJECT_CODE tenderProjectCode,
        gcn.NOTICE_NAME noticeName,
        gcn.NOTICE_CONTENT noticeContent,
        gcn.NOTICE_SEND_TIME noticeSendTime,
        gcn.NOTICE_NATURE noticeNature,
        gct.REGION_CODE regionCode,
        gcp.INDUSTRIES_TYPE industriesTypeCode,
        gcn.PLATFORM_CODE platformCode,
        gcn.BULLETIN_TYPE bulletinTypeCode,
        gcn.BULLETIN_DUTY bulletinDuty,
        gcn.DATA_SOURCE_CODE dataSourceCode,
        gcn.NOTICE_BID_NUM noticeBidNum,
        gcn.BID_SECTION_CODES bidSectionCodes,
        gcn.DOC_GET_START_TIME docGetStartTime,
        gcn.DOC_GET_END_TIME docGetEndTime,
        gcn.BID_DOC_REFER_END_TIME bidDocReferEndTime,
        gcn.BID_OPEN_TIME bidOpenTime
        from
        GC_NOTICEANDFILE gcn
        left join GC_TENDERPROJECT gct
        on gct.TENDER_PROJECT_CODE = gcn.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 gcn.PLATFORM_CODE =  #{platformCode}
            </if>
            <if test="industriesType != null and industriesType != ''">
                and gcp.INDUSTRIES_TYPE = #{industriesType}
            </if>
            <if test="noticeSendTimeStart != null and noticeSendTimeStart != ''">
                and gcn.NOTICE_SEND_TIME &gt;= #{noticeSendTimeStart}
            </if>
            <if test="noticeSendTimeEnd != null and noticeSendTimeEnd != ''">
                and gcn.NOTICE_SEND_TIME &lt;= #{noticeSendTimeEnd}
            </if>
            <if test="noticeName != null and noticeName != ''">
                <bind name="noticeName" value="'%'+noticeName+'%'"/>
                and gcn.NOTICE_NAME like #{noticeName}
            </if>
            <if test="time != null and time != ''">
                and gcn.DATA_TIMESTAMP &gt; #{time}
            </if>
        </where>

    </select>

    <select id="maxDataTimeStamp" resultType="java.lang.Long">
        select max(DATA_TIMESTAMP) from "ggzyexchange"."gc_noticeandfile";
    </select>

</mapper>
