使用数据库用户表代替配置文件
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.genersoft.iot.vmp.storager.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.gb28181.bean.GbStream;
|
||||
import com.genersoft.iot.vmp.storager.dao.dto.User;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface UserMapper {
|
||||
|
||||
@Insert("INSERT INTO user (username, password, roleId, create_time) VALUES" +
|
||||
"('${username}', '${password}', '${roleId}', datetime('now','localtime'))")
|
||||
int add(User user);
|
||||
|
||||
@Update("UPDATE user " +
|
||||
"SET username=#{username}," +
|
||||
"password=#{password}," +
|
||||
"roleId=#{roleId}" +
|
||||
"WHERE id=#{id}")
|
||||
int update(User user);
|
||||
|
||||
@Delete("DELETE FROM user WHERE app=#{app} AND id=#{id}")
|
||||
int delete(User user);
|
||||
|
||||
@Select("select * FROM user WHERE username= #{username} AND password=#{password}")
|
||||
User select(String username, String password);
|
||||
|
||||
@Select("select * FROM user WHERE id= #{id}")
|
||||
User selectById(int id);
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.genersoft.iot.vmp.storager.dao.dto;
|
||||
|
||||
public class User {
|
||||
|
||||
private int id;
|
||||
private String username;
|
||||
private String password;
|
||||
private String createTime;
|
||||
private int roleId;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public int getRoleId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
public void setRoleId(int roleId) {
|
||||
this.roleId = roleId;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user