Commit 491c2809 by YG8999

设备日志信息完善

parent 07e16f2d
......@@ -50,6 +50,13 @@ public class DeviceLog extends BaseEntity
@Excel(name = "消息主题")
private String topic;
@Excel(name = "消息回复结果")
@TableField(value = "`result`")
private String result;
@Excel(name = "描述")
private String description;
/**
* 房间名称
*/
......
......@@ -644,11 +644,15 @@ public class MqttxServiceImpl implements MqttxService {
private boolean updateDeviceLog(String topic, String payload) {
JSONObject json = JSONUtil.parseObj(payload);
if (json.size() > 0) {
DeviceLog deviceLog = new DeviceLog();
String seq = json.getStr("seq");
deviceLog.setSeq(seq);
deviceLog.setRemark(payload);
return 0 < deviceLogMapper.updateBySeq(deviceLog);
JSONArray array = json.getJSONArray("params");
if (array != null && array.size() > 0) {
DeviceLog deviceLog = new DeviceLog();
String seq = json.getStr("seq");
deviceLog.setSeq(seq);
deviceLog.setRemark(payload);
deviceLog.setResult(array.getStr(1));
return 0 < deviceLogMapper.updateBySeq(deviceLog);
}
}
return false;
}
......
......@@ -18,10 +18,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="result" column="result" />
<result property="description" column="description" />
</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 from s_device_log
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
</sql>
<select id="selectDeviceLogList" parameterType="DeviceLog" resultMap="DeviceLogResult">
......@@ -44,7 +47,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</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,
t1.create_by, t1.create_time, t1.update_by, t1.update_time, t1.remark
t1.create_by, t1.create_time, t1.update_by, t1.update_time, t1.remark,
t1.`result`, t1.description
FROM s_device_log t1
JOIN (
SELECT MAX(id) AS max_id
......@@ -74,6 +78,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="result != null">`result`,</if>
<if test="description != null">description,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="devMac != null">#{devMac},</if>
......@@ -88,6 +94,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="result != null">#{result},</if>
<if test="description != null">#{description},</if>
</trim>
</insert>
......@@ -106,11 +114,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="result != null">`result` = #{result},</if>
<if test="description != null">description = #{description},</if>
</trim>
where id = #{id}
</update>
<update id="updateBySeq" parameterType="DeviceLog">
update s_device_log set remark = #{remark} where seq = #{seq}
update s_device_log
set remark = #{remark},`result` = #{result}
where seq = #{seq}
</update>
<delete id="deleteDeviceLogById" parameterType="Long">
......
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