init_object,增加了不完全的登录API,完善数据库设计
This commit is contained in:
@@ -32,6 +32,62 @@
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-junit-jupiter</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.flywaydb</groupId>
|
||||
<artifactId>flyway-mysql</artifactId>
|
||||
</dependency>
|
||||
<!--引入mysql-connector-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.28</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.2.8</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<exclusions>
|
||||
<!-- 排除mybatis-spring,此版本的mybatis-plus中自带的mybatis-spring和springboot3不兼容-->
|
||||
<exclusion>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>3.5.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Sa-Token 权限认证,在线文档:https://sa-token.cc -->
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-spring-boot3-starter</artifactId>
|
||||
<version>1.38.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis-spring</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>3.5.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
package com.guo.learningprogresstracker;
|
||||
|
||||
import cn.dev33.satoken.SaManager;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* 应用程序启动类
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class LearningProgressTrackerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(LearningProgressTrackerApplication.class, args);
|
||||
System.out.println("启动成功,Sa-Token 配置如下:" + SaManager.getConfig());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.guo.learningprogresstracker.controller;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.CommonResult;
|
||||
import com.guo.learningprogresstracker.domain.model.LoginBody;
|
||||
import com.guo.learningprogresstracker.exception.AppException;
|
||||
import com.guo.learningprogresstracker.service.LoginService;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
*/
|
||||
@CrossOrigin
|
||||
@RestController
|
||||
public class LoginController {
|
||||
|
||||
@Resource
|
||||
private LoginService loginService;
|
||||
|
||||
@PostMapping("/login")
|
||||
public CommonResult<Object> login(@RequestBody LoginBody loginBody) throws AppException {
|
||||
String token = loginService.login(loginBody.getUsername(),loginBody.getPassword());
|
||||
return CommonResult.success("登录成功!",token);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.guo.learningprogresstracker.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
*/
|
||||
@Data
|
||||
public class BaseEntity {
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createdBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updatedBy;
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.guo.learningprogresstracker.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 存储每次学习开始前的预期
|
||||
* @TableName study_expectations
|
||||
*/
|
||||
@TableName(value ="study_expectations")
|
||||
@Data
|
||||
public class StudyExpectationsEntity extends BaseEntity implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "expectation_id", type = IdType.AUTO)
|
||||
private Integer expectationId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "session_id")
|
||||
private Integer sessionId;
|
||||
|
||||
/**
|
||||
* 学习预期的详细描述
|
||||
*/
|
||||
@TableField(value = "description")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_time")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_time")
|
||||
private LocalDateTime lastModifiedTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_by")
|
||||
private String lastModifiedBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
+62
@@ -0,0 +1,62 @@
|
||||
package com.guo.learningprogresstracker.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 记录学习过程中的学习内容报告残片
|
||||
* @TableName study_report_fragments
|
||||
*/
|
||||
@TableName(value ="study_report_fragments")
|
||||
@Data
|
||||
public class StudyReportFragmentsEntity extends BaseEntity implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "fragment_id", type = IdType.AUTO)
|
||||
private Integer fragmentId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "session_id")
|
||||
private Integer sessionId;
|
||||
|
||||
/**
|
||||
* 学习内容的描述
|
||||
*/
|
||||
@TableField(value = "content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_time")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_time")
|
||||
private LocalDateTime lastModifiedTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_by")
|
||||
private String lastModifiedBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.guo.learningprogresstracker.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 存储每次学习结束时的完整学习报告
|
||||
* @TableName study_reports
|
||||
*/
|
||||
@TableName(value ="study_reports")
|
||||
@Data
|
||||
public class StudyReportsEntity extends BaseEntity implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "report_id", type = IdType.AUTO)
|
||||
private Integer reportId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "session_id")
|
||||
private Integer sessionId;
|
||||
|
||||
/**
|
||||
* 完整的学习报告内容
|
||||
*/
|
||||
@TableField(value = "content")
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "created_time")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_time")
|
||||
private LocalDateTime lastModifiedTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_by")
|
||||
private String lastModifiedBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.guo.learningprogresstracker.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 记录每次学习会话的具体数据
|
||||
* @TableName study_sessions
|
||||
*/
|
||||
@TableName(value ="study_sessions")
|
||||
@Data
|
||||
public class StudySessionsEntity extends BaseEntity implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "session_id", type = IdType.AUTO)
|
||||
private Integer sessionId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "task_id")
|
||||
private Integer taskId;
|
||||
|
||||
/**
|
||||
* 学习开始时间
|
||||
*/
|
||||
@TableField(value = "start_time")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 学习结束时间
|
||||
*/
|
||||
@TableField(value = "end_time")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
/**
|
||||
* 实际使用时间(分钟)
|
||||
*/
|
||||
@TableField(value = "actual_time")
|
||||
private Integer actualTime;
|
||||
|
||||
/**
|
||||
* 有效学习时间(分钟)
|
||||
*/
|
||||
@TableField(value = "effective_time")
|
||||
private Integer effectiveTime;
|
||||
|
||||
/**
|
||||
* 有效时间比
|
||||
*/
|
||||
@TableField(value = "effectiveness_ratio")
|
||||
private Double effectivenessRatio;
|
||||
|
||||
/**
|
||||
* 学习会话的状态(进行中、暂停、已结束)
|
||||
*/
|
||||
@TableField(value = "session_state")
|
||||
private String sessionState;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_time")
|
||||
private LocalDateTime lastModifiedTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_by")
|
||||
private String lastModifiedBy;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_time")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
package com.guo.learningprogresstracker.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 存储学习任务的基本信息,包括优先级的多维度计算
|
||||
* @TableName tasks
|
||||
*/
|
||||
@TableName(value ="tasks")
|
||||
@Data
|
||||
public class TasksEntity extends BaseEntity implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId(value = "task_id", type = IdType.AUTO)
|
||||
private Integer taskId;
|
||||
|
||||
/**
|
||||
* 学习任务的名称
|
||||
*/
|
||||
@TableField(value = "task_name")
|
||||
private String taskName;
|
||||
|
||||
/**
|
||||
* 学习材料的存储URL
|
||||
*/
|
||||
@TableField(value = "material_url")
|
||||
private String materialUrl;
|
||||
|
||||
/**
|
||||
* 用户设置的任务紧急性
|
||||
*/
|
||||
@TableField(value = "urgency")
|
||||
private Integer urgency;
|
||||
|
||||
/**
|
||||
* 用户设置的任务重要性
|
||||
*/
|
||||
@TableField(value = "importance")
|
||||
private Integer importance;
|
||||
|
||||
/**
|
||||
* 任务的内容难度
|
||||
*/
|
||||
@TableField(value = "content_difficulty")
|
||||
private Integer contentDifficulty;
|
||||
|
||||
/**
|
||||
* 任务的未来价值
|
||||
*/
|
||||
@TableField(value = "future_value")
|
||||
private Integer futureValue;
|
||||
|
||||
/**
|
||||
* 用户对任务的主观优先级
|
||||
*/
|
||||
@TableField(value = "subjective_priority")
|
||||
private Integer subjectivePriority;
|
||||
|
||||
/**
|
||||
* 通过算法计算得出的任务优先级
|
||||
*/
|
||||
@TableField(value = "calculated_priority")
|
||||
private Double calculatedPriority;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_time")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_time")
|
||||
private LocalDateTime lastModifiedTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_by")
|
||||
private String lastModifiedBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.guo.learningprogresstracker.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户信息表
|
||||
* @TableName user
|
||||
*/
|
||||
@TableName(value ="user")
|
||||
@Data
|
||||
public class UserEntity extends BaseEntity implements Serializable {
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 账号-登录用
|
||||
*/
|
||||
@TableField(value = "user_name")
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 账号密码
|
||||
*/
|
||||
@TableField(value = "user_password")
|
||||
private String userPassword;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_time")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
private String createdBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.guo.learningprogresstracker.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 存储用户-任务之间的对应关系
|
||||
* @TableName user_task
|
||||
*/
|
||||
@TableName(value ="user_task")
|
||||
@Data
|
||||
public class UserTaskEntity extends BaseEntity implements Serializable {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
@TableField(value = "user_id")
|
||||
private Integer userId;
|
||||
|
||||
/**
|
||||
* 任务id
|
||||
*/
|
||||
@TableField(value = "task_id")
|
||||
private Integer taskId;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_time")
|
||||
private LocalDateTime createdTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "created_by")
|
||||
private String createdBy;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_time")
|
||||
private LocalDateTime lastModifiedTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(value = "last_modified_by")
|
||||
private String lastModifiedBy;
|
||||
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.guo.learningprogresstracker.domain.model;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 登录-数据模型
|
||||
* @author guo
|
||||
*/
|
||||
@Data
|
||||
public class LoginBody {
|
||||
private String username;
|
||||
private String password;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.guo.learningprogresstracker.mapper;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.StudyExpectationsEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_expectations(存储每次学习开始前的预期)】的数据库操作Mapper
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
* @Entity com.guo.learningprogresstracker.entity.StudyExpectationsEntity
|
||||
*/
|
||||
@Mapper
|
||||
public interface StudyExpectationsMapper extends BaseMapper<StudyExpectationsEntity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.guo.learningprogresstracker.mapper;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.StudyReportFragmentsEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_report_fragments(记录学习过程中的学习内容报告残片)】的数据库操作Mapper
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
* @Entity com.guo.learningprogresstracker.entity.StudyReportFragmentsEntity
|
||||
*/
|
||||
@Mapper
|
||||
public interface StudyReportFragmentsMapper extends BaseMapper<StudyReportFragmentsEntity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.guo.learningprogresstracker.mapper;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.StudyReportsEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_reports(存储每次学习结束时的完整学习报告)】的数据库操作Mapper
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
* @Entity com.guo.learningprogresstracker.entity.StudyReportsEntity
|
||||
*/
|
||||
@Mapper
|
||||
public interface StudyReportsMapper extends BaseMapper<StudyReportsEntity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.guo.learningprogresstracker.mapper;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.StudySessionsEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_sessions(记录每次学习会话的具体数据)】的数据库操作Mapper
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
* @Entity com.guo.learningprogresstracker.entity.StudySessionsEntity
|
||||
*/
|
||||
@Mapper
|
||||
public interface StudySessionsMapper extends BaseMapper<StudySessionsEntity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.guo.learningprogresstracker.mapper;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.TasksEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【tasks(存储学习任务的基本信息,包括优先级的多维度计算)】的数据库操作Mapper
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
* @Entity com.guo.learningprogresstracker.entity.TasksEntity
|
||||
*/
|
||||
@Mapper
|
||||
public interface TasksMapper extends BaseMapper<TasksEntity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.guo.learningprogresstracker.mapper;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.UserEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【user(用户信息表)】的数据库操作Mapper
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
* @Entity com.guo.learningprogresstracker.entity.UserEntity
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserMapper extends BaseMapper<UserEntity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.guo.learningprogresstracker.mapper;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.UserTaskEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【user_task(存储用户-任务之间的对应关系)】的数据库操作Mapper
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
* @Entity com.guo.learningprogresstracker.entity.UserTaskEntity
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserTaskMapper extends BaseMapper<UserTaskEntity> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.guo.learningprogresstracker.service;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.CommonResult;
|
||||
import com.guo.learningprogresstracker.exception.AppException;
|
||||
|
||||
public interface LoginService {
|
||||
|
||||
String login(String username, String password) throws AppException;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.guo.learningprogresstracker.service;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.StudyExpectationsEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_expectations(存储每次学习开始前的预期)】的数据库操作Service
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
public interface StudyExpectationsService extends IService<StudyExpectationsEntity> {
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.guo.learningprogresstracker.service;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.StudyReportFragmentsEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_report_fragments(记录学习过程中的学习内容报告残片)】的数据库操作Service
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
public interface StudyReportFragmentsService extends IService<StudyReportFragmentsEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.guo.learningprogresstracker.service;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.StudyReportsEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_reports(存储每次学习结束时的完整学习报告)】的数据库操作Service
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
public interface StudyReportsService extends IService<StudyReportsEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.guo.learningprogresstracker.service;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.StudySessionsEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_sessions(记录每次学习会话的具体数据)】的数据库操作Service
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
public interface StudySessionsService extends IService<StudySessionsEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.guo.learningprogresstracker.service;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.TasksEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【tasks(存储学习任务的基本信息,包括优先级的多维度计算)】的数据库操作Service
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
public interface TasksService extends IService<TasksEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.guo.learningprogresstracker.service;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.UserEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【user(用户信息表)】的数据库操作Service
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
public interface UserService extends IService<UserEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.guo.learningprogresstracker.service;
|
||||
|
||||
import com.guo.learningprogresstracker.domain.entity.UserTaskEntity;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【user_task(存储用户-任务之间的对应关系)】的数据库操作Service
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
public interface UserTaskService extends IService<UserTaskEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.guo.learningprogresstracker.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.guo.learningprogresstracker.domain.entity.CommonResult;
|
||||
import com.guo.learningprogresstracker.domain.entity.UserEntity;
|
||||
import com.guo.learningprogresstracker.exception.AppException;
|
||||
import com.guo.learningprogresstracker.service.LoginService;
|
||||
import com.guo.learningprogresstracker.service.UserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class LoginServiceImpl implements LoginService {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
@Override
|
||||
public String login(String username, String password) throws AppException {
|
||||
UserEntity userEntity = userService.getOneOpt(Wrappers.<UserEntity>lambdaQuery()
|
||||
.eq(UserEntity::getUserName, username)
|
||||
.eq(UserEntity::getUserPassword, password)).orElseThrow(() -> new AppException("账号或密码错误!"));
|
||||
StpUtil.login(userEntity.getId());
|
||||
//todo Token只在此处使用了,属于后续优化点
|
||||
return StpUtil.getTokenInfo().getTokenValue();
|
||||
}
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.guo.learningprogresstracker.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.guo.learningprogresstracker.domain.entity.StudyExpectationsEntity;
|
||||
import com.guo.learningprogresstracker.service.StudyExpectationsService;
|
||||
import com.guo.learningprogresstracker.mapper.StudyExpectationsMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_expectations(存储每次学习开始前的预期)】的数据库操作Service实现
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
@Service
|
||||
public class StudyExpectationsServiceImpl extends ServiceImpl<StudyExpectationsMapper, StudyExpectationsEntity>
|
||||
implements StudyExpectationsService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.guo.learningprogresstracker.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.guo.learningprogresstracker.domain.entity.StudyReportFragmentsEntity;
|
||||
import com.guo.learningprogresstracker.service.StudyReportFragmentsService;
|
||||
import com.guo.learningprogresstracker.mapper.StudyReportFragmentsMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_report_fragments(记录学习过程中的学习内容报告残片)】的数据库操作Service实现
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
@Service
|
||||
public class StudyReportFragmentsServiceImpl extends ServiceImpl<StudyReportFragmentsMapper, StudyReportFragmentsEntity>
|
||||
implements StudyReportFragmentsService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.guo.learningprogresstracker.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.guo.learningprogresstracker.domain.entity.StudyReportsEntity;
|
||||
import com.guo.learningprogresstracker.service.StudyReportsService;
|
||||
import com.guo.learningprogresstracker.mapper.StudyReportsMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_reports(存储每次学习结束时的完整学习报告)】的数据库操作Service实现
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
@Service
|
||||
public class StudyReportsServiceImpl extends ServiceImpl<StudyReportsMapper, StudyReportsEntity>
|
||||
implements StudyReportsService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
package com.guo.learningprogresstracker.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.guo.learningprogresstracker.domain.entity.StudySessionsEntity;
|
||||
import com.guo.learningprogresstracker.service.StudySessionsService;
|
||||
import com.guo.learningprogresstracker.mapper.StudySessionsMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【study_sessions(记录每次学习会话的具体数据)】的数据库操作Service实现
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
@Service
|
||||
public class StudySessionsServiceImpl extends ServiceImpl<StudySessionsMapper, StudySessionsEntity>
|
||||
implements StudySessionsService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.guo.learningprogresstracker.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.guo.learningprogresstracker.domain.entity.TasksEntity;
|
||||
import com.guo.learningprogresstracker.service.TasksService;
|
||||
import com.guo.learningprogresstracker.mapper.TasksMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【tasks(存储学习任务的基本信息,包括优先级的多维度计算)】的数据库操作Service实现
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
@Service
|
||||
public class TasksServiceImpl extends ServiceImpl<TasksMapper, TasksEntity>
|
||||
implements TasksService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.guo.learningprogresstracker.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.guo.learningprogresstracker.domain.entity.UserEntity;
|
||||
import com.guo.learningprogresstracker.service.UserService;
|
||||
import com.guo.learningprogresstracker.mapper.UserMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【user(用户信息表)】的数据库操作Service实现
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
@Service
|
||||
public class UserServiceImpl extends ServiceImpl<UserMapper, UserEntity>
|
||||
implements UserService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.guo.learningprogresstracker.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.guo.learningprogresstracker.domain.entity.UserTaskEntity;
|
||||
import com.guo.learningprogresstracker.service.UserTaskService;
|
||||
import com.guo.learningprogresstracker.mapper.UserTaskMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author guo
|
||||
* @description 针对表【user_task(存储用户-任务之间的对应关系)】的数据库操作Service实现
|
||||
* @createDate 2024-06-09 15:28:48
|
||||
*/
|
||||
@Service
|
||||
public class UserTaskServiceImpl extends ServiceImpl<UserTaskMapper, UserTaskEntity>
|
||||
implements UserTaskService{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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