init_object,增加了不完全的登录API,完善数据库设计
This commit is contained in:
@@ -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{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user