From 667257a75a228ce7fe50a8a3cc8160628876015f Mon Sep 17 00:00:00 2001
From: 64850858 <648540858@qq.com>
Date: 星期一, 07 六月 2021 16:44:48 +0800
Subject: [PATCH] 添加创建时间与更新时间
---
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java | 6 ++
web_src/src/components/DeviceList.vue | 4 ++
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java | 26 +++++++++++++
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java | 26 +++++++++++++
sql/mysql.sql | 4 ++
src/main/resources/wvp.sqlite | 0
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java | 6 +-
7 files changed, 68 insertions(+), 4 deletions(-)
diff --git a/sql/mysql.sql b/sql/mysql.sql
index 71e651a..7055edd 100644
--- a/sql/mysql.sql
+++ b/sql/mysql.sql
@@ -15,6 +15,8 @@
registerTime varchar(50) null,
keepaliveTime varchar(50) null,
ip varchar(50) not null,
+ createTime varchar(50) not null,
+ updateTime varchar(50) not null,
port int not null,
expires int not null,
hostAddress varchar(50) not null
@@ -49,6 +51,8 @@
deviceId varchar(50) not null,
parental varchar(50) null,
hasAudio bit(1) null,
+ createTime varchar(50) not null,
+ updateTime varchar(50) not null,
primary key (channelId, deviceId)
);
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
index a9185e0..6f3d4d7 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
@@ -84,6 +84,16 @@
*/
private int expires;
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ private String createTime;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ private String updateTime;
+
public String getDeviceId() {
return deviceId;
}
@@ -203,4 +213,20 @@
public void setExpires(int expires) {
this.expires = expires;
}
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime;
+ }
+
+ public String getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(String updateTime) {
+ this.updateTime = updateTime;
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
index ca6ef60..6d40e36 100644
--- a/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
+++ b/src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
@@ -118,6 +118,16 @@
* 浜戝彴绫诲瀷鎻忚堪瀛楃涓�
*/
private String PTZTypeText;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ private String createTime;
+
+ /**
+ * 鏇存柊鏃堕棿
+ */
+ private String updateTime;
/**
* 鍦ㄧ嚎/绂荤嚎
@@ -403,4 +413,20 @@
public void setStreamId(String streamId) {
this.streamId = streamId;
}
+
+ public String getCreateTime() {
+ return createTime;
+ }
+
+ public void setCreateTime(String createTime) {
+ this.createTime = createTime;
+ }
+
+ public String getUpdateTime() {
+ return updateTime;
+ }
+
+ public void setUpdateTime(String updateTime) {
+ this.updateTime = updateTime;
+ }
}
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
index 2f534cf..6b3bd1c 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
@@ -16,15 +16,15 @@
@Insert("INSERT INTO device_channel (channelId, deviceId, name, manufacture, model, owner, civilCode, block, " +
"address, parental, parentId, safetyWay, registerWay, certNum, certifiable, errCode, secrecy, " +
- "ipAddress, port, password, PTZType, status, streamId, longitude, latitude) " +
+ "ipAddress, port, password, PTZType, status, streamId, longitude, latitude, createTime, updateTime) " +
"VALUES ('${channelId}', '${deviceId}', '${name}', '${manufacture}', '${model}', '${owner}', '${civilCode}', '${block}'," +
"'${address}', ${parental}, '${parentId}', ${safetyWay}, ${registerWay}, '${certNum}', ${certifiable}, ${errCode}, '${secrecy}', " +
- "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude})")
+ "'${ipAddress}', ${port}, '${password}', ${PTZType}, ${status}, '${streamId}', ${longitude}, ${latitude}, datetime('now','localtime'), datetime('now','localtime'))")
int add(DeviceChannel channel);
@Update(value = {" <script>" +
"UPDATE device_channel " +
- "SET deviceId='${deviceId}'" +
+ "SET updateTime=datetime('now','localtime'))" +
"<if test=\"name != null\">, name='${name}'</if>" +
"<if test=\"manufacture != null\">, manufacture='${manufacture}'</if>" +
"<if test=\"model != null\">, model='${model}'</if>" +
diff --git a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
index d597f35..4fac2c1 100644
--- a/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
+++ b/src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
@@ -30,6 +30,8 @@
"expires," +
"registerTime," +
"keepaliveTime," +
+ "createTime," +
+ "updateTime," +
"online" +
") VALUES (" +
"#{deviceId}," +
@@ -45,13 +47,15 @@
"#{expires}," +
"#{registerTime}," +
"#{keepaliveTime}," +
+ "datetime('now','localtime')," +
+ "datetime('now','localtime')," +
"#{online}" +
")")
int add(Device device);
@Update(value = {" <script>" +
"UPDATE device " +
- "SET deviceId='${deviceId}'" +
+ "SET updateTime=datetime('now','localtime')" +
"<if test=\"name != null\">, name='${name}'</if>" +
"<if test=\"manufacturer != null\">, manufacturer='${manufacturer}'</if>" +
"<if test=\"model != null\">, model='${model}'</if>" +
diff --git a/src/main/resources/wvp.sqlite b/src/main/resources/wvp.sqlite
index 3131c0f..7c38c43 100644
--- a/src/main/resources/wvp.sqlite
+++ b/src/main/resources/wvp.sqlite
Binary files differ
diff --git a/web_src/src/components/DeviceList.vue b/web_src/src/components/DeviceList.vue
index e05855f..c2971aa 100644
--- a/web_src/src/components/DeviceList.vue
+++ b/web_src/src/components/DeviceList.vue
@@ -46,6 +46,10 @@
</el-table-column>
<el-table-column prop="registerTime" label="鏈�杩戞敞鍐�" align="center" width="140">
</el-table-column>
+ <el-table-column prop="updateTime" label="鏇存柊鏃堕棿" align="center" width="140">
+ </el-table-column>
+ <el-table-column prop="createTime" label="鍒涘缓鏃堕棿" align="center" width="140">
+ </el-table-column>
<el-table-column label="鍦板潃" width="180" align="center">
<template slot-scope="scope">
<div slot="reference" class="name-wrapper">
--
Gitblit v1.8.0