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

    <select id="queryZrzyTdBidwinnoticeList" resultType="com.trs.ggzyexchange.entity.ZrzyTdBidwinnoticeVo">
        select
            ztb.SOURCE_DATA_KEY sourceDataKey,
            ztb.REGION_CODE regionCode,
            ztb.ANNOUNCEMENT_TITLE announcementTitle,
            ztb.PUBLISHING_TIME publishingTime,
            ztb.DEAL_TIME dealTime,
            ztcn.ANNOUNCEMENT_CODE announcementCode
        from
        ZRZY_TD_BIDWINNOTICE ztb
        left join
        zrzy_td_cede_notice ztcn
        on
        ztb.DEAL_ANNOUNCEMENT_GUID = ztcn.ANNOUNCEMENT_GUID
        <where>
            <if test="regionCode != null and regionCode != ''">
                <bind name="regionCode" value="regionCode+'%'"/>
                and ztb.REGION_CODE = #{regionCode}
            </if>
            <if test="announcementTitle != null and announcementTitle != ''">
                <bind name="announcementTitle" value="'%'+announcementTitle+'%'"/>
                and ztb.ANNOUNCEMENT_TITLE like #{announcementTitle}
            </if>
            <if test="landUsage != null and landUsage != ''">
                and ztb.LAND_USAGE = #{landUsage}
            </if>
            <if test="publishingTimeStart != null and publishingTimeStart != ''">
                and ztb.PUBLISHING_TIME  &gt;=  #{publishingTimeStart}
            </if>
            <if test="publishingTimeEnd != null and publishingTimeEnd != ''">
                and ztb.PUBLISHING_TIME  &lt;=  #{publishingTimeEnd}
            </if>
        </where>
        order by ztb.PUBLISHING_TIME desc
    </select>
    <select id="maxDataTimeStamp" resultType="java.lang.Long">
        select max(DATA_TIMESTAMP) from "ggzyexchange"."ZRZY_TD_BIDWINNOTICE";
    </select>
</mapper>
