Commit fcd79b9864b2dc2478bf3f660fae257af0844937

Authored by 648540858
1 parent d7c293c8

用户表增加推流鉴权KEY

sql/mysql.sql
... ... @@ -513,6 +513,7 @@ CREATE TABLE `user` (
513 513 `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
514 514 `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
515 515 `roleId` int NOT NULL,
  516 + `pushKey` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci default null,
516 517 `createTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
517 518 `updateTime` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
518 519 PRIMARY KEY (`id`) USING BTREE,
... ...
sql/update.sql
... ... @@ -57,4 +57,8 @@ alter table stream_push
57 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 10 @Repository
11 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 15 int add(User user);
16 16  
17 17 @Update(value = {" <script>" +
18 18 "UPDATE user " +
19 19 "SET updateTime='${updateTime}' " +
  20 + "<if test=\"pushKey != null\">, pushKey='${pushKey}'</if>" +
20 21 "<if test=\"role != null\">, roleId='${role.id}'</if>" +
21 22 "<if test=\"password != null\">, password='${password}'</if>" +
22 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 7 private String password;
8 8 private String createTime;
9 9 private String updateTime;
  10 + private String pushKey;
10 11 private Role role;
11 12  
12 13 public int getId() {
... ... @@ -56,4 +57,12 @@ public class User {
56 57 public void setRole(Role role) {
57 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 }
... ...