| | |
| | | </when> |
| | | <when test="criterion.listValue"> |
| | | and ${criterion.condition} |
| | | <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=","> |
| | | <foreach close=")" collection="criterion.value" item="listItem" open="(" |
| | | separator=","> |
| | | #{listItem} |
| | | </foreach> |
| | | </when> |
| | |
| | | </foreach> |
| | | </where> |
| | | </sql> |
| | | <sql id="Base_Column_List"> |
| | | <sql id="Base_Column_List">z |
| | | id, name, address, longitude, latitude, mac, operate_user_id, state, is_delete, create_time, |
| | | install_time, monitor_point_id, device_version_id |
| | | </sql> |
| | | |
| | | <select id="countByTimes" resultType="java.util.Map"> |
| | | select DATE_FORMAT(create_time,#{format}) as time, COUNT(*) as count from device |
| | | where create_time >= #{start} |
| | |
| | | AND mp.is_delete = 0 |
| | | AND mp.organization_id = #{organizationId} |
| | | </select> |
| | | <select id="getAllMac" resultType="java.lang.String"> |
| | | SELECT mac FROM `device` where state!=4; |
| | | </select> |
| | | <select id="byMacGetDevice" resultType="com.moral.entity.Device" resultMap="ResultMap"> |
| | | SELECT * from device where mac=#{mac} |
| | | </select> |
| | | <select id="getDeviceAndWindByMac" resultType="com.moral.entity.DeviceAndWind"> |
| | | select d.longitude as longitude,d.latitude as latitude, |
| | | case when h.json->"$.e18[0]"=0 then 0.1 else h.json->"$.e18[0]" end |
| | | as windSpeed, h.json->"$.e23[0]" as windDir, |
| | | h.json->"$.e17[0]" as tVoc |
| | | from ${table} h ,`device` as d |
| | | where d.mac=h.mac and d.mac=#{mac} and h.time=#{time} |
| | | </select> |
| | | <select id="byMonitorIdGetDeviceAndWind" resultType="com.moral.entity.DeviceAndWind"> |
| | | select d.longitude as longitude,d.latitude as latitude, |
| | | case when h.json->"$.e18[0]"=0 then 0.1 else h.json->"$.e18[0]" end |
| | | as windSpeed, h.json->"$.e23[0]" as windDir, |
| | | h.json->"$.e17[0]" as tVoc |
| | | from ${table} h ,`device` as d |
| | | where d.mac=h.mac and h.time=#{time} |
| | | and d.mac in (select d.mac from device , monitor_point as m where d.monitor_point_id=m.id and m.id=#{id}) |
| | | </select> |
| | | |
| | | |
| | | <select id="getDevicesStateByRegion" resultType="map"> |
| | |
| | | AND dev.is_delete =0 |
| | | </where> |
| | | </select> |
| | | <select id="getAllDevice" resultType="com.moral.entity.DeviceAndWind"> |
| | | select d.longitude as longitude,d.latitude as latitude, |
| | | case when h.json->"$.e18[0]"=0 then 0.1 else h.json->"$.e18[0]" end |
| | | as windSpeed, h.json->"$.e23[0]" as windDir |
| | | from history_minutely_202007 h ,`device` as d |
| | | where h.time="2020-07-20 15:30:00" and h.json->"$.e23[0]" is not null and h.mac in(SELECT d.mac FROM monitor_point m |
| | | where d.monitor_point_id=m.id |
| | | ) |
| | | </select> |
| | | |
| | | <select id="getDeviceListByMonitorPointIds" resultType="com.moral.entity.Device"> |
| | | select * from device where monitor_point_id in |