<?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.shanghaichengdi.ghjgitem.mapper.WaterPublicFlightsMapper">

    <resultMap id="BaseResultMap" type="com.shanghaichengdi.ghjgitem.domain.WaterPublicFlights">
            <id property="code" column="CODE" jdbcType="VARCHAR"/>
            <result property="unitName" column="UNIT_NAME" jdbcType="VARCHAR"/>
            <result property="filingMonth" column="FILING_MONTH" jdbcType="VARCHAR"/>
            <result property="cdate" column="CDATE" jdbcType="TIMESTAMP"/>
            <result property="cuser" column="CUSER" jdbcType="VARCHAR"/>
            <result property="udate" column="UDATE" jdbcType="TIMESTAMP"/>
            <result property="uuser" column="UUSER" jdbcType="VARCHAR"/>
            <result property="sumdate" column="SUMDATE" jdbcType="TIMESTAMP"/>
            <result property="sumuser" column="SUMUSER" jdbcType="VARCHAR"/>
            <result property="unitId" column="UNIT_ID" jdbcType="VARCHAR"/>
            <result property="isSumuser" column="IS_SUMUSER" jdbcType="DECIMAL"/>
    </resultMap>

    <sql id="Base_Column_List">
        CODE,UNIT_NAME,FILING_MONTH,
        CDATE,CUSER,UDATE,
        UUSER,SUMDATE,SUMUSER,
        UNIT_ID,IS_SUMUSER
    </sql>

    <select id="getPageList" resultType="com.shanghaichengdi.ghjgitem.vo.response.WaterPublicFlightsRes">
        select code,
               unit_name unitName,
               filing_month filingMonth,
               cdate,
               udate
        from GHJG_BUSSINESS.WATER_PUBLIC_FLIGHTS t
        where t.IS_SUMUSER = 1
        <if test="startDate != null and endDate != null">
            and ((t.CDATE >= to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss') and t.CDATE &lt;= to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss'))
            or (t.UDATE >= to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss') and t.UDATE &lt;= to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')))
        </if>
    </select>
</mapper>
