<?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.GcBidExceptioNoticeMapper">
    <select id="queryGcBidExceptioNoticeList" resultType="com.trs.ggzyexchange.entity.GcBidExceptioNoticeVo">
        select
        gben.SOURCE_DATA_KEY sourceDataKey,
        gct.REGION_CODE regionCode,
        gcp.PROJECT_CODE projectCode,
        gben.TENDER_PROJECT_CODE tenderProjectCode,
        gben.NOTICE_NAME noticeName,
        gben.PLATFORM_CODE platformCode,
        gben.NOTICE_SENDTIME noticeSendTime,
        gben.BULLETIN_TYPE bulletinType,
        gben.INDUSTRIES_TYPE industriesType
        from
        gc_bid_exceptio_notice gben
        left join GC_TENDERPROJECT gct
        on gct.TENDER_PROJECT_CODE = gben.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="industriesType != null and industriesType != ''">
                and gcp.INDUSTRIES_TYPE = #{industriesType}
            </if>
            <if test="platformCode != null and platformCode != ''">
                and gben.PLATFORM_CODE  = #{platformCode}
            </if>
            <if test="noticeSendTimeStart != null and noticeSendTimeStart != ''">
                and gben.NOTICE_SENDTIME &gt;= #{noticeSendTimeStart}
            </if>
            <if test="noticeSendTimeEnd != null and noticeSendTimeEnd != ''">
                and gben.NOTICE_SENDTIME &lt;= #{noticeSendTimeEnd}
            </if>
            <if test="noticeName != null and noticeName != ''">
                <bind name="noticeName" value="'%'+noticeName+'%'"/>
                and gben.NOTICE_NAME like #{noticeName}
            </if>
        </where>
        order by gben.NOTICE_SENDTIME desc
    </select>
    <select id="queryGcBidExceptioNoticeAllList" resultType="com.trs.ggzyexchange.entity.TenderDetailsVo">
        select
            gben.SOURCE_DATA_KEY sourceDataKey,
            gcp.PROJECT_CODE projectCode,
            gcp.PROJECT_NAME projectName,
            gben.TENDER_PROJECT_CODE tenderProjectCode,
            gben.NOTICE_NAME noticeName,
            gben.NOTICE_CONTENT noticeContent,
            gben.NOTICE_SENDTIME noticeSendTime,
            gct.REGION_CODE regionCode,
            gcp.INDUSTRIES_TYPE industriesTypeCode,
            gben.PLATFORM_CODE platformCode,
            gben.BULLETIN_TYPE bulletinTypeCode,
            gben.BULLETIN_DUTY bulletinDuty,
            gben.BID_SECTION_CODE bidSectionCodes
        from
            GC_BID_EXCEPTIO_NOTICE gben
                left join GC_TENDERPROJECT gct
                          on gct.TENDER_PROJECT_CODE = gben.TENDER_PROJECT_CODE
                left join GC_PROJECT gcp
                          on gct.PROJECT_CODE = gcp.PROJECT_CODE
    </select>
    <select id="queryGcBidExceptioNoticeAllListByTime"
            resultType="com.trs.ggzyexchange.entity.TenderDetailsVo">

        select
            gben.SOURCE_DATA_KEY sourceDataKey,
            gcp.PROJECT_CODE projectCode,
            gcp.PROJECT_NAME projectName,
            gben.TENDER_PROJECT_CODE tenderProjectCode,
            gben.NOTICE_NAME noticeName,
            gben.NOTICE_CONTENT noticeContent,
            gben.NOTICE_SENDTIME noticeSendTime,
            gct.REGION_CODE regionCode,
            gcp.INDUSTRIES_TYPE industriesTypeCode,
            gben.PLATFORM_CODE platformCode,
            gben.BULLETIN_TYPE bulletinTypeCode,
            gben.BULLETIN_DUTY bulletinDuty,
            gben.BID_SECTION_CODE bidSectionCodes
        from
            GC_BID_EXCEPTIO_NOTICE gben
                left join GC_TENDERPROJECT gct
                          on gct.TENDER_PROJECT_CODE = gben.TENDER_PROJECT_CODE
                left join GC_PROJECT gcp
                          on gct.PROJECT_CODE = gcp.PROJECT_CODE
        where gben.DATA_TIMESTAMP &gt; #{time}
    </select>
    <select id="maxDataTimeStamp" resultType="java.lang.Long">
        select max(DATA_TIMESTAMP) from "ggzyexchange"."GC_BID_EXCEPTIO_NOTICE";
    </select>
</mapper>
