Commit fc274294 by YG8999

设备网关、设备日志查询条件新增

parent ce4c4e40
......@@ -506,6 +506,7 @@ public class SStoreServiceImpl extends ServiceImpl<SStoreMapper, SStore> impleme
put("id", store.getId());
put("name", store.getName());
put("storeType", store.getStoreType());
put("deviceGroup", store.getDeviceGroup());
}};
return map;
}).collect(Collectors.toList());
......
......@@ -23,27 +23,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDeviceLogVo">
select id, dev_mac, dev_id, seq, mqtt_type, mqtt_describe, payload, topic, create_by, create_time,
update_by, update_time, remark, `result`, description from s_device_log
select s1.id, s1.dev_mac, s1.dev_id, s1.seq, s1.mqtt_type, s1.mqtt_describe, s1.payload, s1.topic,
s1.create_by, s1.create_time,
s1.update_by, s1.update_time, s1.remark, s1.`result`, s1.description
from s_device_log s1
left join s_device s2 on s1.dev_id = s2.dev_id
left join s_room s3 on s2.room_id = s3.id
left join s_store s4 on s3.store_id = s4.id
</sql>
<select id="selectDeviceLogList" parameterType="DeviceLog" resultMap="DeviceLogResult">
<include refid="selectDeviceLogVo"/>
<where>
<if test="devMac != null and devMac != ''"> and dev_mac = #{devMac}</if>
<if test="devId != null and devId != ''"> and dev_id = #{devId}</if>
<if test="seq != null and seq != ''"> and seq = #{seq}</if>
<if test="mqttType != null and mqttType != ''"> and mqtt_type = #{mqttType}</if>
<if test="mqttDescribe != null and mqttDescribe != ''"> and mqtt_describe = #{mqttDescribe}</if>
<if test="payload != null and payload != ''"> and payload = #{payload}</if>
<if test="topic != null and topic != ''"> and topic = #{topic}</if>
<if test="devMac != null and devMac != ''"> and s1.dev_mac = #{devMac}</if>
<if test="devId != null and devId != ''"> and s1.dev_id = #{devId}</if>
<if test="seq != null and seq != ''"> and s1.seq = #{seq}</if>
<if test="mqttType != null and mqttType != ''"> and s1.mqtt_type = #{mqttType}</if>
<if test="mqttDescribe != null and mqttDescribe != ''"> and s1.mqtt_describe = #{mqttDescribe}</if>
<if test="payload != null and payload != ''"> and s1.payload = #{payload}</if>
<if test="topic != null and topic != ''"> and s1.topic = #{topic}</if>
<if test="storeName != null and storeName != ''"> and s4.name like concat('%', #{storeName}, '%')</if>
<if test="roomName != null and roomName != ''"> and s3.name like concat('%', #{roomName}, '%')</if>
</where>
order by create_time desc
order by s1.create_time desc
</select>
<select id="selectDeviceLogById" parameterType="Long" resultMap="DeviceLogResult">
<include refid="selectDeviceLogVo"/>
where id = #{id}
where s1.id = #{id}
</select>
<select id="selectListByMaxId" resultMap="DeviceLogResult">
SELECT t1.id, t1.dev_mac, t1.dev_id, t1.seq, t1.mqtt_type, t1.mqtt_describe, t1.payload, t1.topic,
......
......@@ -22,29 +22,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDeviceStatusLogVo">
select id, dev_id, dev_mac, is_abnormal, status, room_id, voltage, signal_value, create_time, update_time,
remark, operate_log_id, is_send_sms, previous_status from s_device_status_log
select s1.id, s1.dev_id, s1.dev_mac, s1.is_abnormal, s1.status, s1.room_id, s1.voltage,
s1.signal_value, s1.create_time, s1.update_time,
s1.remark, s1.operate_log_id, s1.is_send_sms, s1.previous_status
from s_device_status_log s1
left join s_device s2 on s1.dev_id = s2.dev_id
left join s_room s3 on s2.room_id = s3.id
left join s_store s4 on s3.store_id = s4.id
</sql>
<select id="selectDeviceStatusLogList" parameterType="DeviceStatusLog" resultMap="DeviceStatusLogResult">
<include refid="selectDeviceStatusLogVo"/>
<where>
<if test="devId != null and devId != ''"> and dev_id = #{devId}</if>
<if test="devMac != null and devMac != ''"> and dev_mac = #{devMac}</if>
<if test="isAbnormal != null "> and is_abnormal = #{isAbnormal}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="roomId != null "> and room_id = #{roomId}</if>
<if test="voltage != null and voltage != ''"> and voltage = #{voltage}</if>
<if test="signalValue != null and signalValue != ''"> and signal_value = #{signalValue}</if>
<if test="operateLogId != null "> and operate_log_id = #{operateLogId}</if>
<if test="isSendSms != null "> and is_send_sms = #{isSendSms}</if>
<if test="devId != null and devId != ''"> and s1.dev_id = #{devId}</if>
<if test="devMac != null and devMac != ''"> and s1.dev_mac = #{devMac}</if>
<if test="isAbnormal != null "> and s1.is_abnormal = #{isAbnormal}</if>
<if test="status != null and status != ''"> and s1.status = #{status}</if>
<if test="roomId != null "> and s1.room_id = #{roomId}</if>
<if test="voltage != null and voltage != ''"> and s1.voltage = #{voltage}</if>
<if test="signalValue != null and signalValue != ''"> and s1.signal_value = #{signalValue}</if>
<if test="operateLogId != null "> and s1.operate_log_id = #{operateLogId}</if>
<if test="isSendSms != null "> and s1.is_send_sms = #{isSendSms}</if>
<if test="storeName != null and storeName != ''"> and s4.name like concat('%', #{storeName}, '%')</if>
<if test="roomName != null and roomName != ''"> and s3.name like concat('%', #{roomName}, '%')</if>
</where>
order by create_time desc
order by s1.create_time desc
</select>
<select id="selectDeviceStatusLogById" parameterType="Long" resultMap="DeviceStatusLogResult">
<include refid="selectDeviceStatusLogVo"/>
where id = #{id}
where s1.id = #{id}
</select>
<insert id="insertDeviceStatusLog" parameterType="DeviceStatusLog">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment