| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?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.xunmei.iot.mapper.IotCommonSensorMapper">
- <select id="selectPageData" resultType="com.xunmei.iot.vo.sensor.SensorPageVo">
- select s.id, org_id, org_name,org_path, device_name, device_type, infos as info,device_code, state_update_time as updateTime,state
- from iot_sensor s
- where s.deleted=0
- <if test="request.orgId!= null">
- and s.org_id=#{request.orgId}
- </if>
- <if test="request.orgPath!= null">
- and s.org_path like CONCAT(#{request.orgPath}, '%')
- </if>
- <if test="request.deviceName != null and request.deviceName!= ''">
- and s.device_name like CONCAT('%',#{request.deviceName},'%')
- </if>
- <if test="request.state!= null">
- and s.state = #{request.state}
- </if>
- <if test="request.deviceType!= null and request.deviceType!= ''">
- and s.device_type = #{request.deviceType}
- </if>
- <if test="request.startTime!= null">
- and s.state_update_time >=#{request.startTime}
- </if>
- <if test="request.endTime!= null">
- and s.state_update_time <![CDATA[<=]]> #{request.endTime}
- </if>
- </select>
- <select id="selectAppPageData" resultType="com.xunmei.iot.vo.sensor.SensorAppPageVo">
- select s.id,org_name, device_name, device_type, infos as info,device_code, state_update_time ,state
- from iot_sensor s
- where s.deleted=0
- <if test="request.orgId!= null">
- and s.org_id=#{request.orgId}
- </if>
- <if test="request.orgPath!= null">
- and s.org_path like CONCAT(#{request.orgPath}, '%')
- </if>
- <if test="request.state!= null">
- and s.state = #{request.state}
- </if>
- <if test="request.deviceType!= null and request.deviceType!= ''">
- and s.device_type = #{request.deviceType}
- </if>
- </select>
- <select id="stateStatistic" resultType="com.xunmei.iot.vo.sensor.SensorAppStateVo">
- SELECT sum(state=0) as normal,
- sum(state=1) as alarm
- from iot_sensor s
- where s.deleted=0
- <if test="request.orgId!= null">
- and s.org_id=#{request.orgId}
- </if>
- <if test="request.orgPath!= null">
- and s.org_path like CONCAT(#{request.orgPath}, '%')
- </if>
- <!-- <if test="request.deviceType!= null and request.deviceType!= ''">-->
- <!-- and s.device_type = #{request.deviceType}-->
- <!-- </if>-->
- </select>
- <select id="selectSensorLogDataPage" resultType="com.xunmei.iot.vo.sensor.SensorPageVo">
- select s.id, org_id, org_name, device_name, infos as info,device_code, update_time from
- iot_sensor_log s
- <where>
- <if test="request.orgId!= null">
- and s.org_id=#{request.orgId}
- </if>
- <if test="request.orgPath!= null">
- and s.org_path like CONCAT(#{request.orgPath}, '%')
- </if>
- <if test="request.deviceName != null and request.deviceName!= ''">
- and s.device_name like CONCAT('%',#{request.deviceName},'%')
- </if>
- <if test="request.deviceCode != null and request.deviceCode!= ''">
- and s.device_code =#{request.deviceCode}
- </if>
- <if test="request.startTime!= null">
- and s.state_update_time >=#{request.startTime}
- </if>
- <if test="request.endTime!= null">
- and s.state_update_time <![CDATA[<=]]> #{request.endTime}
- </if>
- </where>
- order by s.create_time desc
- </select>
- <select id="selectByIds" resultType="com.xunmei.common.core.domain.iot.domain.IotSensor">
- SELECT
- org_id,
- CONCAT(b.affiliated_area,'-',b.affiliated_bank,'-',b.short_name) as org_name,
- device_name,
- infos AS info,
- device_code
- FROM
- iot_sensor a
- LEFT JOIN sys_org b ON a.org_id = b.id
- where device_code in
- <foreach collection="deviceIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </select>
- <select id="selectListData" resultType="com.xunmei.iot.vo.sensor.SensorExportVo">
- select org_name, device_name, device_type, infos as info,update_time,state
- from iot_sensor s
- where s.deleted=0
- <if test="request.orgId!= null">
- and s.org_id=#{request.orgId}
- </if>
- <if test="request.orgPath!= null">
- and s.org_path like CONCAT(#{request.orgPath}, '%')
- </if>
- <if test="request.deviceName != null and request.deviceName!= ''">
- and s.device_name like CONCAT('%',#{request.deviceName},'%')
- </if>
- <if test="request.state!= null">
- and s.state = #{request.state}
- </if>
- <if test="request.deviceType!= null">
- and s.device_type = #{request.deviceType}
- </if>
- <if test="request.startTime!= null">
- and s.state_update_time >=#{request.startTime}
- </if>
- <if test="request.endTime!= null">
- and s.state_update_time <![CDATA[<=]]> #{request.endTime}
- </if>
- </select>
- </mapper>
|