Commit fcd79b9864b2dc2478bf3f660fae257af0844937

Authored by 648540858
1 parent d7c293c8

用户表增加推流鉴权KEY

sql/mysql.sql
@@ -513,6 +513,7 @@ CREATE TABLE `user` ( @@ -513,6 +513,7 @@ CREATE TABLE `user` (
513 `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, 513 `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
514 `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, 514 `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
515 `roleId` int NOT NULL, 515 `roleId` int NOT NULL,
  516 + `pushKey` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci default null,
516 `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, 517 `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
517 `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, 518 `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
518 PRIMARY KEY (`id`) USING BTREE, 519 PRIMARY KEY (`id`) USING BTREE,
sql/update.sql
@@ -57,4 +57,8 @@ alter table stream_push @@ -57,4 +57,8 @@ alter table stream_push
57 change createStamp createTime varchar(50) default null; 57 change createStamp createTime varchar(50) default null;
58 58
59 59
  60 +alter table user
  61 + add pushKey varchar(50) default null;
  62 +
  63 +
60 64
src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java
@@ -10,13 +10,14 @@ import java.util.List; @@ -10,13 +10,14 @@ import java.util.List;
10 @Repository 10 @Repository
11 public interface UserMapper { 11 public interface UserMapper {
12 12
13 - @Insert("INSERT INTO user (username, password, roleId, createTime, updateTime) VALUES" +  
14 - "('${username}', '${password}', '${role.id}', '${createTime}', '${updateTime}')") 13 + @Insert("INSERT INTO user (username, password, roleId, pushKey, createTime, updateTime) VALUES" +
  14 + "('${username}', '${password}', '${role.id}', '${pushKey}', '${createTime}', '${updateTime}')")
15 int add(User user); 15 int add(User user);
16 16
17 @Update(value = {" <script>" + 17 @Update(value = {" <script>" +
18 "UPDATE user " + 18 "UPDATE user " +
19 "SET updateTime='${updateTime}' " + 19 "SET updateTime='${updateTime}' " +
  20 + "<if test=\"pushKey != null\">, pushKey='${pushKey}'</if>" +
20 "<if test=\"role != null\">, roleId='${role.id}'</if>" + 21 "<if test=\"role != null\">, roleId='${role.id}'</if>" +
21 "<if test=\"password != null\">, password='${password}'</if>" + 22 "<if test=\"password != null\">, password='${password}'</if>" +
22 "<if test=\"username != null\">, username='${username}'</if>" + 23 "<if test=\"username != null\">, username='${username}'</if>" +
src/main/java/com/genersoft/iot/vmp/storager/dao/dto/User.java
@@ -7,6 +7,7 @@ public class User { @@ -7,6 +7,7 @@ public class User {
7 private String password; 7 private String password;
8 private String createTime; 8 private String createTime;
9 private String updateTime; 9 private String updateTime;
  10 + private String pushKey;
10 private Role role; 11 private Role role;
11 12
12 public int getId() { 13 public int getId() {
@@ -56,4 +57,12 @@ public class User { @@ -56,4 +57,12 @@ public class User {
56 public void setRole(Role role) { 57 public void setRole(Role role) {
57 this.role = role; 58 this.role = role;
58 } 59 }
  60 +
  61 + public String getPushKey() {
  62 + return pushKey;
  63 + }
  64 +
  65 + public void setPushKey(String pushKey) {
  66 + this.pushKey = pushKey;
  67 + }
59 } 68 }