| | |
| | | </foreach>
|
| | | </otherwise>
|
| | | </choose>
|
| | | DATE_FORMAT(time,'${@com.moral.common.util.ReportTimeFormat@toMySqlTimeFormat(timePeriod.timeUnits)}') as format_time
|
| | | DATE_FORMAT(time,'${@com.moral.common.util.ReportTimeFormat@toMySqlTimeFormat(timePeriod.timeUnits)}') as
|
| | | format_time
|
| | | FROM
|
| | | `history_minutely` hmi
|
| | | <where>
|
| | | and hmi.time >= #{timePeriod.startTime}
|
| | | and hmi.time <![CDATA[<=]]> #{timePeriod.endTime}
|
| | | <if test="dataCondition.actualTime != null">
|
| | | and DATE_FORMAT(time, '${@com.moral.common.util.ReportTimeFormat@toMySqlActualTimeFormat(dataCondition.timeUnits)}') = #{dataCondition.actualTime}
|
| | | and DATE_FORMAT(time,
|
| | | '${@com.moral.common.util.ReportTimeFormat@toMySqlActualTimeFormat(dataCondition.timeUnits)}') =
|
| | | #{dataCondition.actualTime}
|
| | | </if>
|
| | | and hmi.mac in (
|
| | | select mac from device dev
|
| | |
| | | </if>
|
| | | ORDER BY format_time asc
|
| | | </select>
|
| | |
|
| | | <!-- 无人机sensor查询 -->
|
| | | <select id="getSensorData" resultType="java.util.LinkedHashMap">
|
| | | SELECT
|
| | | <foreach collection="sensorKeys"
|
| | | item="sensorKey" separator="," close=",">
|
| | | hm.json->'$.${sensorKey}[0]' as '${sensorKey}'
|
| | | </foreach>
|
| | | DATE_FORMAT(hm.time,'%Y-%m-%d %H:%i:%s') as uavDate
|
| | | FROM
|
| | | history_minutely as hm
|
| | | <where>
|
| | | <if test="mac!=null and mac!=''">
|
| | | and hm.mac=#{mac}
|
| | | </if>
|
| | | </where>
|
| | | <choose>
|
| | | <when test="startTime !=null and startTime != '' and endTime!=null and endTime !='' ">
|
| | | and hm.time >= #{startTime}
|
| | | and hm.time <![CDATA[<=]]> #{endTime}
|
| | | </when>
|
| | | <when test="startTime !=null and startTime != '' ">
|
| | | and hm.time >= #{startTime}
|
| | | </when>
|
| | | <when test="endTime !=null and endTime != '' ">
|
| | | and hm.time <![CDATA[<=]]> #{endTime}
|
| | | </when>
|
| | | <otherwise>
|
| | | and hm.time >= DATE_ADD(NOW(), INTERVAL -30 MINUTE)
|
| | | and hm.time <![CDATA[<=]]> now()
|
| | | </otherwise>
|
| | | </choose>
|
| | | ORDER BY hm.time
|
| | | </select>
|
| | | </mapper> |