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

    <resultMap id="BaseResultMap" type="com.shanghaichengdi.ghjgitem.domain.WaterSelfOperated">
            <id property="code" column="CODE" jdbcType="VARCHAR"/>
            <result property="unitName" column="UNIT_NAME" jdbcType="VARCHAR"/>
            <result property="unitNumber" column="UNIT_NUMBER" jdbcType="VARCHAR"/>
            <result property="declareDateMonth" column="DECLARE_DATE_MONTH" jdbcType="VARCHAR"/>
            <result property="sailDateStart" column="SAIL_DATE_START" jdbcType="VARCHAR"/>
            <result property="sailDateEnd" column="SAIL_DATE_END" jdbcType="VARCHAR"/>
            <result property="shipName" column="SHIP_NAME" jdbcType="VARCHAR"/>
            <result property="dockAtTheDockName" column="DOCK_AT_THE_DOCK_NAME" jdbcType="VARCHAR"/>
            <result property="dockAtTheDockCode" column="DOCK_AT_THE_DOCK_CODE" jdbcType="VARCHAR"/>
            <result property="ticketPrice" column="TICKET_PRICE" jdbcType="VARCHAR"/>
            <result property="routeType" column="ROUTE_TYPE" jdbcType="VARCHAR"/>
            <result property="featuredContent" column="FEATURED_CONTENT" jdbcType="VARCHAR"/>
            <result property="featuredContentCode" column="FEATURED_CONTENT_CODE" jdbcType="VARCHAR"/>
            <result property="createUserId" column="CREATE_USER_ID" jdbcType="VARCHAR"/>
            <result property="createDate" column="CREATE_DATE" jdbcType="TIMESTAMP"/>
            <result property="upUserId" column="UP_USER_ID" jdbcType="VARCHAR"/>
            <result property="upDate" column="UP_DATE" jdbcType="TIMESTAMP"/>
            <result property="operatingDateSta" column="OPERATING_DATE_STA" jdbcType="VARCHAR"/>
            <result property="operatedType" column="OPERATED_TYPE" jdbcType="DECIMAL"/>
            <result property="operatingDateEnd" column="OPERATING_DATE_END" jdbcType="VARCHAR"/>
            <result property="isSubmit" column="IS_SUBMIT" jdbcType="DECIMAL"/>
            <result property="submitDate" column="SUBMIT_DATE" jdbcType="TIMESTAMP"/>
            <result property="submitUserId" column="SUBMIT_USER_ID" jdbcType="VARCHAR"/>
            <result property="infoState" column="INFO_STATE" jdbcType="DECIMAL"/>
            <result property="status" column="STATUS" jdbcType="DECIMAL"/>
            <result property="createUser" column="CREATE_USER" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        CODE,UNIT_NAME,UNIT_NUMBER,
        DECLARE_DATE_MONTH,SAIL_DATE_START,SAIL_DATE_END,
        SHIP_NAME,DOCK_AT_THE_DOCK_NAME,DOCK_AT_THE_DOCK_CODE,
        TICKET_PRICE,ROUTE_TYPE,FEATURED_CONTENT,
        FEATURED_CONTENT_CODE,CREATE_USER_ID,CREATE_DATE,
        UP_USER_ID,UP_DATE,OPERATING_DATE_STA,
        OPERATED_TYPE,OPERATING_DATE_END,IS_SUBMIT,
        SUBMIT_DATE,SUBMIT_USER_ID,INFO_STATE,
        STATUS,CREATE_USER
    </sql>

    <select id="getPageList" resultType="com.shanghaichengdi.ghjgitem.vo.response.WaterSelfOperatedRes">
        select code,
               unit_name unitName,
               unit_number unitNumber,
               declare_date_month declareDateMonth,
               sail_date_start sailDateStart,
               sail_date_end sailDateEnd,
               ship_name shipName,
               dock_at_the_dock_name dockAtTheDockName,
               ticket_price ticketPrice,
               route_type routeType,
               featured_content featuredContent,
               OPERATING_DATE_STA operatingDateSta,
               OPERATING_DATE_END operatingDateEnd,
               OPERATED_TYPE operatedType,
               create_date createDate,
               up_date
        from  GHJG_BUSSINESS.WATER_SELF_OPERATED t
        where t.info_state = 0
        <if test="startDate != null and endDate != null">
            and ((t.CREATE_DATE >= to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss') and t.CREATE_DATE &lt;= to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss'))
            or (t.UP_DATE >= to_date(#{startDate},'yyyy-mm-dd hh24:mi:ss') and t.UP_DATE &lt;= to_date(#{endDate},'yyyy-mm-dd hh24:mi:ss')))
        </if>
    </select>

</mapper>
