|
|
@ -8,22 +8,16 @@ import org.jetbrains.exposed.sql.Column |
|
|
|
import org.jetbrains.exposed.sql.`java-time`.datetime |
|
|
|
import org.jetbrains.exposed.sql.`java-time`.datetime |
|
|
|
import java.time.LocalDateTime |
|
|
|
import java.time.LocalDateTime |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 用户 |
|
|
|
@TableComment("用户") |
|
|
|
*/ |
|
|
|
|
|
|
|
object Users: IntIdTable(){ |
|
|
|
object Users: IntIdTable(){ |
|
|
|
/** |
|
|
|
@TableComment("学号") |
|
|
|
* 学号 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
val studentId:Column<String> = varchar(name="student_id",length = 8).uniqueIndex() |
|
|
|
val studentId:Column<String> = varchar(name="student_id",length = 8).uniqueIndex() |
|
|
|
/** |
|
|
|
|
|
|
|
* 姓名 |
|
|
|
@TableComment("姓名") |
|
|
|
*/ |
|
|
|
|
|
|
|
val name:Column<String> = varchar(name="name",length = 10) |
|
|
|
val name:Column<String> = varchar(name="name",length = 10) |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@TableComment("密码") |
|
|
|
* 密码,hash加密 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
val password:Column<String> = varchar(name="password",length = 32) |
|
|
|
val password:Column<String> = varchar(name="password",length = 32) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -34,29 +28,22 @@ class User(id:EntityID<Int>):IntEntity(id){ |
|
|
|
var password by Users.password |
|
|
|
var password by Users.password |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@TableComment("用户授权令牌") |
|
|
|
* 用户授权令牌 |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
object UserTokens: IntIdTable(){ |
|
|
|
object UserTokens: IntIdTable(){ |
|
|
|
/** |
|
|
|
|
|
|
|
* 授权学号 |
|
|
|
@TableComment("授权学号") |
|
|
|
*/ |
|
|
|
|
|
|
|
val studentId:Column<String> = reference("student_id",Users.studentId) |
|
|
|
val studentId:Column<String> = reference("student_id",Users.studentId) |
|
|
|
/** |
|
|
|
|
|
|
|
* 令牌 |
|
|
|
@TableComment("令牌") |
|
|
|
*/ |
|
|
|
|
|
|
|
val token:Column<String> = varchar(name="token",length = 32) |
|
|
|
val token:Column<String> = varchar(name="token",length = 32) |
|
|
|
/** |
|
|
|
|
|
|
|
* 授权ip地址 |
|
|
|
@TableComment("授权ip地址") |
|
|
|
*/ |
|
|
|
|
|
|
|
val ip:Column<String> = varchar(name="ip",length = 32) |
|
|
|
val ip:Column<String> = varchar(name="ip",length = 32) |
|
|
|
/** |
|
|
|
|
|
|
|
* 令牌创建时间 |
|
|
|
@TableComment("令牌创建时间") |
|
|
|
*/ |
|
|
|
|
|
|
|
val createTime:Column<LocalDateTime> = datetime("create_time").default(LocalDateTime.now()) |
|
|
|
val createTime:Column<LocalDateTime> = datetime("create_time").default(LocalDateTime.now()) |
|
|
|
/** |
|
|
|
|
|
|
|
* 授权设备 |
|
|
|
@TableComment("授权设备") |
|
|
|
*/ |
|
|
|
|
|
|
|
val device:Column<String> = varchar(name="device",length = 256) |
|
|
|
val device:Column<String> = varchar(name="device",length = 256) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|