init_object,增加了不完全的登录API,完善数据库设计
This commit is contained in:
@@ -1 +0,0 @@
|
||||
spring.application.name=LearningProgressTracker
|
||||
@@ -0,0 +1,45 @@
|
||||
spring:
|
||||
application:
|
||||
name: LearningProgressTracker
|
||||
# 配置数据库
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/learning_progress_tracker?characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password:
|
||||
flyway:
|
||||
# 是否启动 flyway
|
||||
enabled: true
|
||||
# 文件编码
|
||||
encoding: UTF-8
|
||||
# SQL 脚本位置,默认位于 classpath 下的 db/migration 目录
|
||||
locations: classpath:db/migration
|
||||
# SQL 迁移文件的前缀,默认为 V
|
||||
sql-migration-prefix: V
|
||||
# SQL 迁移文件中版本与描述间的分隔符,默认为两个下划线 __
|
||||
sql-migration-separator: __
|
||||
# SQL 迁移文件的后缀,默认为 .sql
|
||||
sql-migration-suffixes: .sql
|
||||
# 是否在迁移时进行验证,默认为 true
|
||||
validate-on-migrate: true
|
||||
# 如果 true,首次迁移时基于现有 schema 创建 baseline,这通常用于将 Flyway 集成到已存在的数据库项目中
|
||||
baseline-on-migrate: true
|
||||
server:
|
||||
port: 8081
|
||||
|
||||
############## Sa-Token 配置 (文档: https://sa-token.cc) ##############
|
||||
sa-token:
|
||||
# token 名称(同时也是 cookie 名称)
|
||||
token-name: satoken
|
||||
# token 有效期(单位:秒) 默认30天,-1 代表永久有效
|
||||
timeout: 2592000
|
||||
# token 最低活跃频率(单位:秒),如果 token 超过此时间没有访问系统就会被冻结,默认-1 代表不限制,永不冻结
|
||||
active-timeout: -1
|
||||
# 是否允许同一账号多地同时登录 (为 true 时允许一起登录, 为 false 时新登录挤掉旧登录)
|
||||
is-concurrent: true
|
||||
# 在多人登录同一账号时,是否共用一个 token (为 true 时所有登录共用一个 token, 为 false 时每次登录新建一个 token)
|
||||
is-share: true
|
||||
# token 风格(默认可取值:uuid、simple-uuid、random-32、random-64、random-128、tik)
|
||||
token-style: uuid
|
||||
# 是否输出操作日志
|
||||
is-log: true
|
||||
@@ -0,0 +1,47 @@
|
||||
-- 创建学习任务表
|
||||
CREATE TABLE Tasks (
|
||||
TaskID INT AUTO_INCREMENT PRIMARY KEY,
|
||||
TaskName VARCHAR(255) NOT NULL COMMENT '学习任务的名称',
|
||||
MaterialURL VARCHAR(255) NOT NULL COMMENT '学习材料的存储URL',
|
||||
Urgency INT DEFAULT 0 COMMENT '用户设置的任务紧急性',
|
||||
Importance INT DEFAULT 0 COMMENT '用户设置的任务重要性',
|
||||
ContentDifficulty INT DEFAULT 0 COMMENT '任务的内容难度',
|
||||
FutureValue INT DEFAULT 0 COMMENT '任务的未来价值',
|
||||
SubjectivePriority INT DEFAULT 0 COMMENT '用户对任务的主观优先级',
|
||||
CalculatedPriority FLOAT DEFAULT 0 COMMENT '通过算法计算得出的任务优先级'
|
||||
) COMMENT '存储学习任务的基本信息,包括优先级的多维度计算';
|
||||
|
||||
-- 创建学习会话表
|
||||
CREATE TABLE StudySessions (
|
||||
SessionID INT AUTO_INCREMENT PRIMARY KEY,
|
||||
TaskID INT NOT NULL,
|
||||
StartTime DATETIME NOT NULL COMMENT '学习开始时间',
|
||||
EndTime DATETIME COMMENT '学习结束时间',
|
||||
ActualTime INT DEFAULT 0 COMMENT '实际使用时间(分钟)',
|
||||
EffectiveTime INT DEFAULT 0 COMMENT '有效学习时间(分钟)',
|
||||
EffectivenessRatio FLOAT DEFAULT 0 COMMENT '有效时间比',
|
||||
SessionState VARCHAR(50) DEFAULT '进行中' COMMENT '学习会话的状态(进行中、暂停、已结束)'
|
||||
) COMMENT '记录每次学习会话的具体数据';
|
||||
|
||||
-- 创建学习预期表
|
||||
CREATE TABLE StudyExpectations (
|
||||
ExpectationID INT AUTO_INCREMENT PRIMARY KEY,
|
||||
SessionID INT NOT NULL,
|
||||
Description TEXT NOT NULL COMMENT '学习预期的详细描述'
|
||||
) COMMENT '存储每次学习开始前的预期';
|
||||
|
||||
-- 创建学习报告残片表
|
||||
CREATE TABLE StudyReportFragments (
|
||||
FragmentID INT AUTO_INCREMENT PRIMARY KEY,
|
||||
SessionID INT NOT NULL,
|
||||
Content TEXT NOT NULL COMMENT '学习内容的描述',
|
||||
CreatedTime DATETIME NOT NULL COMMENT '创建时间'
|
||||
) COMMENT '记录学习过程中的学习内容报告残片';
|
||||
|
||||
-- 创建学习报告表
|
||||
CREATE TABLE StudyReports (
|
||||
ReportID INT AUTO_INCREMENT PRIMARY KEY,
|
||||
SessionID INT NOT NULL,
|
||||
Content TEXT NOT NULL COMMENT '完整的学习报告内容',
|
||||
CreatedTime DATETIME NOT NULL COMMENT '创建时间'
|
||||
) COMMENT '存储每次学习结束时的完整学习报告';
|
||||
@@ -0,0 +1,8 @@
|
||||
# 增加testTable表
|
||||
create table test_table
|
||||
(
|
||||
id int auto_increment comment '测试主键'
|
||||
primary key,
|
||||
id_name varchar(255) null
|
||||
)
|
||||
comment '测试表';
|
||||
@@ -0,0 +1,19 @@
|
||||
# 增加user表
|
||||
create table user
|
||||
(
|
||||
id varchar(255) not null comment '用户id'
|
||||
primary key,
|
||||
user_name varchar(20) not null comment '账号-登录用',
|
||||
user_password varchar(30) not null comment '账号密码'
|
||||
)
|
||||
comment '用户信息表';
|
||||
|
||||
# 添加user_task表
|
||||
create table user_task
|
||||
(
|
||||
id varchar(255) null,
|
||||
user_id int null comment '用户id',
|
||||
task_id int null comment '任务id'
|
||||
)
|
||||
comment '存储用户-任务之间的对应关系';
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
-- 重命名学习任务表
|
||||
ALTER TABLE Tasks RENAME TO tasks;
|
||||
|
||||
-- 重命名学习会话表
|
||||
ALTER TABLE StudySessions RENAME TO study_sessions;
|
||||
|
||||
-- 重命名学习预期表
|
||||
ALTER TABLE StudyExpectations RENAME TO study_expectations;
|
||||
|
||||
-- 重命名学习报告残片表
|
||||
ALTER TABLE StudyReportFragments RENAME TO study_report_fragments;
|
||||
|
||||
-- 重命名学习报告表
|
||||
ALTER TABLE StudyReports RENAME TO study_reports;
|
||||
@@ -0,0 +1,48 @@
|
||||
-- 对于已经包含 created_time 的表(study_report_fragments, study_reports, study_sessions),添加其他必要字段
|
||||
|
||||
ALTER TABLE study_report_fragments
|
||||
ADD COLUMN created_by varchar(255) NULL,
|
||||
ADD COLUMN last_modified_time datetime NULL,
|
||||
ADD COLUMN last_modified_by varchar(255) NULL;
|
||||
|
||||
ALTER TABLE study_reports
|
||||
ADD COLUMN created_by varchar(255) NULL,
|
||||
ADD COLUMN last_modified_time datetime NULL,
|
||||
ADD COLUMN last_modified_by varchar(255) NULL;
|
||||
|
||||
ALTER TABLE study_sessions
|
||||
ADD COLUMN created_by varchar(255) NULL,
|
||||
ADD COLUMN last_modified_time datetime NULL,
|
||||
ADD COLUMN last_modified_by varchar(255) NULL;
|
||||
|
||||
-- 对于其他表,添加所有四个管理字段
|
||||
|
||||
ALTER TABLE study_expectations
|
||||
ADD COLUMN created_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
ADD COLUMN created_by varchar(255) NULL,
|
||||
ADD COLUMN last_modified_time datetime NULL,
|
||||
ADD COLUMN last_modified_by varchar(255) NULL;
|
||||
|
||||
ALTER TABLE tasks
|
||||
ADD COLUMN created_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
ADD COLUMN created_by varchar(255) NULL,
|
||||
ADD COLUMN last_modified_time datetime NULL,
|
||||
ADD COLUMN last_modified_by varchar(255) NULL;
|
||||
|
||||
ALTER TABLE test_table
|
||||
ADD COLUMN created_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
ADD COLUMN created_by varchar(255) NULL,
|
||||
ADD COLUMN last_modified_time datetime NULL,
|
||||
ADD COLUMN last_modified_by varchar(255) NULL;
|
||||
|
||||
ALTER TABLE user
|
||||
ADD COLUMN created_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
ADD COLUMN created_by varchar(255) NULL,
|
||||
ADD COLUMN last_modified_time datetime NULL,
|
||||
ADD COLUMN last_modified_by varchar(255) NULL;
|
||||
|
||||
ALTER TABLE user_task
|
||||
ADD COLUMN created_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
||||
ADD COLUMN created_by varchar(255) NULL,
|
||||
ADD COLUMN last_modified_time datetime NULL,
|
||||
ADD COLUMN last_modified_by varchar(255) NULL;
|
||||
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE study_sessions
|
||||
ADD COLUMN created_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL;
|
||||
@@ -0,0 +1,5 @@
|
||||
ALTER TABLE user
|
||||
CHANGE last_modified_time update_time datetime NULL;
|
||||
|
||||
ALTER TABLE user
|
||||
CHANGE last_modified_by updated_by varchar(255) NULL;
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.guo.learningprogresstracker.mapper.StudyExpectationsMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.guo.learningprogresstracker.domain.entity.StudyExpectationsEntity">
|
||||
<id property="expectationId" column="expectation_id" jdbcType="INTEGER"/>
|
||||
<result property="sessionId" column="session_id" jdbcType="INTEGER"/>
|
||||
<result property="description" column="description" jdbcType="VARCHAR"/>
|
||||
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
||||
<result property="lastModifiedTime" column="last_modified_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="lastModifiedBy" column="last_modified_by" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
expectation_id,session_id,description,
|
||||
created_time,created_by,last_modified_time,
|
||||
last_modified_by
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.guo.learningprogresstracker.mapper.StudyReportFragmentsMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.guo.learningprogresstracker.domain.entity.StudyReportFragmentsEntity">
|
||||
<id property="fragmentId" column="fragment_id" jdbcType="INTEGER"/>
|
||||
<result property="sessionId" column="session_id" jdbcType="INTEGER"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
||||
<result property="lastModifiedTime" column="last_modified_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="lastModifiedBy" column="last_modified_by" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
fragment_id,session_id,content,
|
||||
created_time,created_by,last_modified_time,
|
||||
last_modified_by
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.guo.learningprogresstracker.mapper.StudyReportsMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.guo.learningprogresstracker.domain.entity.StudyReportsEntity">
|
||||
<id property="reportId" column="report_id" jdbcType="INTEGER"/>
|
||||
<result property="sessionId" column="session_id" jdbcType="INTEGER"/>
|
||||
<result property="content" column="content" jdbcType="VARCHAR"/>
|
||||
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
||||
<result property="lastModifiedTime" column="last_modified_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="lastModifiedBy" column="last_modified_by" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
report_id,session_id,content,
|
||||
created_time,created_by,last_modified_time,
|
||||
last_modified_by
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.guo.learningprogresstracker.mapper.StudySessionsMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.guo.learningprogresstracker.domain.entity.StudySessionsEntity">
|
||||
<id property="sessionId" column="session_id" jdbcType="INTEGER"/>
|
||||
<result property="taskId" column="task_id" jdbcType="INTEGER"/>
|
||||
<result property="startTime" column="start_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="endTime" column="end_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="actualTime" column="actual_time" jdbcType="INTEGER"/>
|
||||
<result property="effectiveTime" column="effective_time" jdbcType="INTEGER"/>
|
||||
<result property="effectivenessRatio" column="effectiveness_ratio" jdbcType="FLOAT"/>
|
||||
<result property="sessionState" column="session_state" jdbcType="VARCHAR"/>
|
||||
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
||||
<result property="lastModifiedTime" column="last_modified_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="lastModifiedBy" column="last_modified_by" jdbcType="VARCHAR"/>
|
||||
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
session_id,task_id,start_time,
|
||||
end_time,actual_time,effective_time,
|
||||
effectiveness_ratio,session_state,created_by,
|
||||
last_modified_time,last_modified_by,created_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.guo.learningprogresstracker.mapper.TasksMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.guo.learningprogresstracker.domain.entity.TasksEntity">
|
||||
<id property="taskId" column="task_id" jdbcType="INTEGER"/>
|
||||
<result property="taskName" column="task_name" jdbcType="VARCHAR"/>
|
||||
<result property="materialUrl" column="material_url" jdbcType="VARCHAR"/>
|
||||
<result property="urgency" column="urgency" jdbcType="INTEGER"/>
|
||||
<result property="importance" column="importance" jdbcType="INTEGER"/>
|
||||
<result property="contentDifficulty" column="content_difficulty" jdbcType="INTEGER"/>
|
||||
<result property="futureValue" column="future_value" jdbcType="INTEGER"/>
|
||||
<result property="subjectivePriority" column="subjective_priority" jdbcType="INTEGER"/>
|
||||
<result property="calculatedPriority" column="calculated_priority" jdbcType="FLOAT"/>
|
||||
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
||||
<result property="lastModifiedTime" column="last_modified_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="lastModifiedBy" column="last_modified_by" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
task_id,task_name,material_url,
|
||||
urgency,importance,content_difficulty,
|
||||
future_value,subjective_priority,calculated_priority,
|
||||
created_time,created_by,last_modified_time,
|
||||
last_modified_by
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.guo.learningprogresstracker.mapper.UserMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.guo.learningprogresstracker.domain.entity.UserEntity">
|
||||
<id property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="userName" column="user_name" jdbcType="VARCHAR"/>
|
||||
<result property="userPassword" column="user_password" jdbcType="VARCHAR"/>
|
||||
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
||||
<result property="lastModifiedTime" column="last_modified_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="lastModifiedBy" column="last_modified_by" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_name,user_password,
|
||||
created_time,created_by,last_modified_time,
|
||||
last_modified_by
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.guo.learningprogresstracker.mapper.UserTaskMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.guo.learningprogresstracker.domain.entity.UserTaskEntity">
|
||||
<result property="id" column="id" jdbcType="VARCHAR"/>
|
||||
<result property="userId" column="user_id" jdbcType="INTEGER"/>
|
||||
<result property="taskId" column="task_id" jdbcType="INTEGER"/>
|
||||
<result property="createdTime" column="created_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="createdBy" column="created_by" jdbcType="VARCHAR"/>
|
||||
<result property="lastModifiedTime" column="last_modified_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="lastModifiedBy" column="last_modified_by" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id,user_id,task_id,
|
||||
created_time,created_by,last_modified_time,
|
||||
last_modified_by
|
||||
</sql>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user