|  |  |  | 
|---|
|  |  |  | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | 
|---|
|  |  |  | <mapper namespace="com.moral.api.mapper.DeviceMapper"> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!-- 通用查询映射结果 --> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.moral.api.entity.Device"> | 
|---|
|  |  |  | <id column="id" property="id" /> | 
|---|
|  |  |  | <result column="name" property="name" /> | 
|---|
|  |  |  | <result column="mac" property="mac" /> | 
|---|
|  |  |  | <result column="address" property="address" /> | 
|---|
|  |  |  | <result column="longitude" property="longitude" /> | 
|---|
|  |  |  | <result column="latitude" property="latitude" /> | 
|---|
|  |  |  | <result column="state" property="state" /> | 
|---|
|  |  |  | <result column="operate_ids" property="operateIds" /> | 
|---|
|  |  |  | <result column="monitor_point_id" property="monitorPointId" /> | 
|---|
|  |  |  | <result column="organization_id" property="organizationId" /> | 
|---|
|  |  |  | <result column="device_version_id" property="deviceVersionId" /> | 
|---|
|  |  |  | <result column="profession" property="profession" /> | 
|---|
|  |  |  | <result column="tech" property="tech" /> | 
|---|
|  |  |  | <result column="detector" property="detector" /> | 
|---|
|  |  |  | <result column="purchaser" property="purchaser" /> | 
|---|
|  |  |  | <result column="create_time" property="createTime" /> | 
|---|
|  |  |  | <result column="update_time" property="updateTime" /> | 
|---|
|  |  |  | <result column="install_time" property="installTime" /> | 
|---|
|  |  |  | <result column="is_delete" property="isDelete" /> | 
|---|
|  |  |  | <result column="extend" property="extend" /> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <!-- 通用查询映射结果 --> | 
|---|
|  |  |  | <resultMap id="BaseResultMap" type="com.moral.api.entity.Device"> | 
|---|
|  |  |  | <id column="id" property="id"/> | 
|---|
|  |  |  | <result column="name" property="name"/> | 
|---|
|  |  |  | <result column="mac" property="mac"/> | 
|---|
|  |  |  | <result column="address" property="address"/> | 
|---|
|  |  |  | <result column="longitude" property="longitude"/> | 
|---|
|  |  |  | <result column="latitude" property="latitude"/> | 
|---|
|  |  |  | <result column="state" property="state"/> | 
|---|
|  |  |  | <result column="operate_ids" property="operateIds"/> | 
|---|
|  |  |  | <result column="monitor_point_id" property="monitorPointId"/> | 
|---|
|  |  |  | <result column="organization_id" property="organizationId"/> | 
|---|
|  |  |  | <result column="guid" property="guid"/> | 
|---|
|  |  |  | <result column="device_version_id" property="deviceVersionId"/> | 
|---|
|  |  |  | <result column="profession" property="profession"/> | 
|---|
|  |  |  | <result column="tech" property="tech"/> | 
|---|
|  |  |  | <result column="detector" property="detector"/> | 
|---|
|  |  |  | <result column="purchaser" property="purchaser"/> | 
|---|
|  |  |  | <result column="create_time" property="createTime"/> | 
|---|
|  |  |  | <result column="update_time" property="updateTime"/> | 
|---|
|  |  |  | <result column="install_time" property="installTime"/> | 
|---|
|  |  |  | <result column="is_delete" property="isDelete"/> | 
|---|
|  |  |  | <result column="extend" property="extend"/> | 
|---|
|  |  |  | <result column="town_code" property="townCode"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <!--监测因子趋势图数据--> | 
|---|
|  |  |  | <select id="getTrendChartData" resultType="java.util.Map"> | 
|---|
|  |  |  | SELECT mac, | 
|---|
|  |  |  | DATE_FORMAT(`time`,#{dateFormat}) AS `time`, | 
|---|
|  |  |  | `value`->'$.${sensorCode}' AS '${sensorCode}' | 
|---|
|  |  |  | FROM history_${timeUnits} | 
|---|
|  |  |  | WHERE mac IN | 
|---|
|  |  |  | <foreach collection="macs" item="mac" index="index" open="(" close=")" separator=","> | 
|---|
|  |  |  | #{mac} | 
|---|
|  |  |  | </foreach> | 
|---|
|  |  |  | AND `time` <![CDATA[>=]]> #{start} | 
|---|
|  |  |  | AND `time` <![CDATA[<]]> #{end} | 
|---|
|  |  |  | ORDER BY `time` | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | </mapper> | 
|---|