<?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="org.jeecg.modules.newWarning.mapper.RealTimeZjMapper">

    <resultMap id="Ltd" type="org.jeecg.modules.warning.entity.Ltd">
    </resultMap>

    <!--	<select id="selectList" parameterType="hashMap" resultMap="Ltd">
            select * from ${table}
            <where>
                <if test="timeStart != null and timeStart != ''">
                    and TO_DATE(SUBSTR(TIME, 1, 19), 'yyyy-MM-dd HH24:mi:ss') >= to_date(#{timeStart},'yyyy-mm-dd hh24:mi:ss')
                </if>
                <if test="timeEnd != null and timeEnd !=''">
                    and TO_DATE(SUBSTR(TIME, 1, 19), 'yyyy-MM-dd HH24:mi:ss') &lt;= to_date(#{timeEnd},'yyyy-mm-dd hh24:mi:ss')
                </if>
            </where>
            ORDER BY TIME
        </select>-->
    <select id="selectList" parameterType="hashMap" resultMap="Ltd">
        select * from "${table}"
        <where>
            <if test="timeStart != null and timeStart != ''">
                and TIME >= #{timeStart}
            </if>
            <if test="timeEnd != null and timeEnd !=''">
                and TIME &lt;= #{timeEnd}
            </if>
        </where>
        ORDER BY TIME
    </select>

    <select id="selectNewOne" parameterType="String" resultMap="Ltd">
        select *
        from "${table}"
        where TIME = (SELECT MAX (TIME) FROM "${table}" )
    </select>

    <select id="selectYData" parameterType="hashMap" resultMap="Ltd">
        select TIME
        from "${table}"
        ORDER BY TIME
    </select>
    <select id="selectDate" parameterType="hashMap" resultMap="Ltd">
        select TIME
        from (select TIME from "${table}" order by TIME desc) t
        where rownum=1
    </select>
    <select id="selectAllDate" parameterType="hashMap" resultType="java.util.Map">
        select distinct SUBSTR(TIME, 1, 10) as TIME
        from "${table}"
        order by TIME desc
    </select>

    <select id="selectByTimeAndJh" resultType="org.jeecg.modules.warning.entity.Ltd">
        select
            *
        from "${table}"
        where
        TIME = #{time}
        and rownum = 1
    </select>

    <select id="getCondition" resultType="org.jeecg.modules.warning.entity.ConditionDateItem">
        select
            time , operating_mode , motion
        from "${table}"
        where
        TIME > #{startTime} and TIME &lt; #{endTime}
        order by TIME asc
    </select>

</mapper>
