Explorar el Código

用户表增加推流鉴权KEY

648540858 hace 3 años
padre
commit
fcd79b9864

+ 1 - 0
sql/mysql.sql

@@ -513,6 +513,7 @@ CREATE TABLE `user` (
                         `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
                         `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
                         `roleId` int NOT NULL,
+                        `pushKey` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci default null,
                         `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
                         `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
                         PRIMARY KEY (`id`) USING BTREE,

+ 4 - 0
sql/update.sql

@@ -57,4 +57,8 @@ alter table stream_push
     change createStamp createTime varchar(50) default null;
 
 
+alter table user
+    add pushKey varchar(50) default null;
+
+
 

+ 3 - 2
src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java

@@ -10,13 +10,14 @@ import java.util.List;
 @Repository
 public interface UserMapper {
 
-    @Insert("INSERT INTO user (username, password, roleId, createTime, updateTime) VALUES" +
-            "('${username}', '${password}', '${role.id}', '${createTime}', '${updateTime}')")
+    @Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" +
+            "('${username}', '${password}', '${role.id}', '${pushKey}', '${createTime}', '${updateTime}')")
     int add(User user);
 
     @Update(value = {" <script>" +
             "UPDATE user " +
             "SET updateTime='${updateTime}' " +
+            "<if test=\"pushKey != null\">, pushKey='${pushKey}'</if>" +
             "<if test=\"role != null\">, roleId='${role.id}'</if>" +
             "<if test=\"password != null\">, password='${password}'</if>" +
             "<if test=\"username != null\">, username='${username}'</if>" +

+ 9 - 0
src/main/java/com/genersoft/iot/vmp/storager/dao/dto/User.java

@@ -7,6 +7,7 @@ public class User {
     private String password;
     private String createTime;
     private String updateTime;
+    private String pushKey;
     private Role role;
 
     public int getId() {
@@ -56,4 +57,12 @@ public class User {
     public void setRole(Role role) {
         this.role = role;
     }
+
+    public String getPushKey() {
+        return pushKey;
+    }
+
+    public void setPushKey(String pushKey) {
+        this.pushKey = pushKey;
+    }
 }