Compare commits
No commits in common. 'master3' and 'main' have entirely different histories.
@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" project-jdk-name="23" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/remotebelongstous.iml" filepath="$PROJECT_DIR$/.idea/remotebelongstous.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,54 @@
|
||||
package com.shanzhu.oe.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 管理员
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class Admin {
|
||||
|
||||
/**
|
||||
* 管理员id
|
||||
*/
|
||||
private Integer adminId;
|
||||
|
||||
/**
|
||||
* 管理员名字
|
||||
*/
|
||||
private String adminName;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
private String tel;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String pwd;
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String cardId;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
private String role;
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.shanzhu.oe.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 考试管理
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class ExamManage {
|
||||
|
||||
/**
|
||||
* 考试编号
|
||||
*/
|
||||
private Integer examCode;
|
||||
|
||||
/**
|
||||
* 该次考试介绍
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String source;
|
||||
|
||||
/**
|
||||
* 试卷编号
|
||||
*/
|
||||
private Integer paperId;
|
||||
|
||||
/**
|
||||
* 考试日期
|
||||
*/
|
||||
private String examDate;
|
||||
|
||||
/**
|
||||
* 持续时长
|
||||
*/
|
||||
private Integer totalTime;
|
||||
|
||||
/**
|
||||
* 年级
|
||||
*/
|
||||
private String grade;
|
||||
|
||||
/**
|
||||
* 学期
|
||||
*/
|
||||
private String term;
|
||||
|
||||
/**
|
||||
* 专业
|
||||
*/
|
||||
private String major;
|
||||
|
||||
/**
|
||||
* 学院
|
||||
*/
|
||||
private String institute;
|
||||
|
||||
/**
|
||||
* 总分
|
||||
*/
|
||||
private Integer totalScore;
|
||||
|
||||
/**
|
||||
* 考试类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 考生须知
|
||||
*/
|
||||
private String tips;
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.shanzhu.oe.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 填空题
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class FillQuestion {
|
||||
|
||||
/**
|
||||
* 试题编号
|
||||
*/
|
||||
private Integer questionId;
|
||||
|
||||
/**
|
||||
* 考试科目
|
||||
*/
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 试题内容
|
||||
*/
|
||||
private String question;
|
||||
|
||||
/**
|
||||
* 正确答案
|
||||
*/
|
||||
private String answer;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
private Integer score;
|
||||
|
||||
/**
|
||||
* 难度等级
|
||||
*/
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 难度等级
|
||||
*/
|
||||
private String section;
|
||||
|
||||
/**
|
||||
* 题目解析
|
||||
*/
|
||||
private String analysis;
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.shanzhu.oe.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 判断题
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class JudgeQuestion {
|
||||
|
||||
/**
|
||||
* 试题编号
|
||||
*/
|
||||
private Integer questionId;
|
||||
|
||||
/**
|
||||
* 考试科目
|
||||
*/
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 试题内容
|
||||
*/
|
||||
private String question;
|
||||
|
||||
/**
|
||||
* 正确答案
|
||||
*/
|
||||
private String answer;
|
||||
|
||||
/**
|
||||
* 难度等级
|
||||
*/
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 所属章节
|
||||
*/
|
||||
private String section;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
private Integer score;
|
||||
|
||||
/**
|
||||
* 题目解析
|
||||
*/
|
||||
private String analysis;
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.shanzhu.oe.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 选择题
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class MultiQuestion {
|
||||
|
||||
/**
|
||||
* 实体编号
|
||||
*/
|
||||
private Integer questionId;
|
||||
|
||||
/**
|
||||
* 考试科目
|
||||
*/
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 所属章节
|
||||
*/
|
||||
private String section;
|
||||
|
||||
/**
|
||||
* 选项A
|
||||
*/
|
||||
private String answerA;
|
||||
|
||||
/**
|
||||
* 选项B
|
||||
*/
|
||||
private String answerB;
|
||||
|
||||
/**
|
||||
* 选项C
|
||||
*/
|
||||
private String answerC;
|
||||
|
||||
/**
|
||||
* 选项D
|
||||
*/
|
||||
private String answerD;
|
||||
|
||||
/**
|
||||
* 问题
|
||||
*/
|
||||
private String question;
|
||||
|
||||
/**
|
||||
* 难度等级
|
||||
*/
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 正确答案
|
||||
*/
|
||||
private String rightAnswer;
|
||||
|
||||
/**
|
||||
* 题目解析
|
||||
*/
|
||||
private String analysis;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
private Integer score;
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.shanzhu.oe.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 试卷
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class PaperManage {
|
||||
|
||||
/**
|
||||
* 试卷id
|
||||
*/
|
||||
private Integer paperId;
|
||||
|
||||
/**
|
||||
* 题目类型
|
||||
*/
|
||||
private Integer questionType;
|
||||
|
||||
/**
|
||||
* 题目编号
|
||||
*/
|
||||
private Integer questionId;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.shanzhu.oe.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 回复
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class Replay {
|
||||
|
||||
/**
|
||||
* 留言id
|
||||
*/
|
||||
private Integer messageId;
|
||||
|
||||
/**
|
||||
* 回复id
|
||||
*/
|
||||
private Integer replayId;
|
||||
|
||||
/**
|
||||
* 回复内容
|
||||
*/
|
||||
private String replay;
|
||||
|
||||
/**
|
||||
* 回复时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||
private Date replayTime;
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.shanzhu.oe.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 考试成绩
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class Score {
|
||||
|
||||
/**
|
||||
* 考试编号
|
||||
*/
|
||||
private Integer examCode;
|
||||
|
||||
/**
|
||||
* 学号
|
||||
*/
|
||||
private Integer studentId;
|
||||
|
||||
/**
|
||||
* 课程名称
|
||||
*/
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 平时成绩
|
||||
*/
|
||||
private Integer ptScore;
|
||||
|
||||
/**
|
||||
* 期末成绩
|
||||
*/
|
||||
private Integer etScore;
|
||||
|
||||
/**
|
||||
* 成绩分数
|
||||
*/
|
||||
private Integer score;
|
||||
|
||||
/**
|
||||
* 成绩编号
|
||||
*/
|
||||
private Integer scoreId;
|
||||
|
||||
/**
|
||||
* 答题日期
|
||||
*/
|
||||
private String answerDate;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,73 @@
|
||||
package com.shanzhu.oe.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 学生
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class Student {
|
||||
|
||||
/**
|
||||
* 学生id
|
||||
*/
|
||||
private Integer studentId;
|
||||
|
||||
/**
|
||||
* 学生姓名
|
||||
*/
|
||||
private String studentName;
|
||||
|
||||
/**
|
||||
* 年级
|
||||
*/
|
||||
private String grade;
|
||||
|
||||
/**
|
||||
* 专业
|
||||
*/
|
||||
private String major;
|
||||
|
||||
/**
|
||||
* 班级
|
||||
*/
|
||||
private String clazz;
|
||||
|
||||
/**
|
||||
* 学院
|
||||
*/
|
||||
private String institute;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
private String tel;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String pwd;
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String cardId;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
private String role;
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.shanzhu.oe.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 教师
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class Teacher {
|
||||
|
||||
/**
|
||||
* 教师id
|
||||
*/
|
||||
private Integer teacherId;
|
||||
|
||||
/**
|
||||
* 教师名字
|
||||
*/
|
||||
private String teacherName;
|
||||
|
||||
/**
|
||||
* 学院
|
||||
*/
|
||||
private String institute;
|
||||
|
||||
/**
|
||||
* 性别
|
||||
*/
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
private String tel;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private String pwd;
|
||||
|
||||
/**
|
||||
* 身份证
|
||||
*/
|
||||
private String cardId;
|
||||
|
||||
/**
|
||||
* 职称
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 角色
|
||||
*/
|
||||
private String role;
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.shanzhu.oe.entity.Admin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理员 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface AdminService {
|
||||
|
||||
/**
|
||||
* 查询所有管理员
|
||||
*
|
||||
* @return 管理员
|
||||
*/
|
||||
List<Admin> findAll();
|
||||
|
||||
/**
|
||||
* 通过管理员id查询
|
||||
*
|
||||
* @param adminId 管理员id
|
||||
* @return 管理员
|
||||
*/
|
||||
Admin findById(Integer adminId);
|
||||
|
||||
/**
|
||||
* 通过管理员id删除
|
||||
*
|
||||
* @param adminId 管理员id
|
||||
* @return 结果
|
||||
*/
|
||||
Integer deleteById(Integer adminId);
|
||||
|
||||
/**
|
||||
* 更新管理员
|
||||
*
|
||||
* @param admin 管理员信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer update(Admin admin);
|
||||
|
||||
/**
|
||||
* 添加管理员
|
||||
*
|
||||
* @param admin 管理员信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer add(Admin admin);
|
||||
|
||||
/**
|
||||
* 更新密码
|
||||
*
|
||||
* @param adminId 管理员id
|
||||
* @param newPsw 新密码
|
||||
* @param oldPsw 旧密码
|
||||
* @return 结果
|
||||
*/
|
||||
Object resetPsw(Integer adminId, String newPsw, String oldPsw);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.vo.AnswerVO;
|
||||
import com.shanzhu.oe.vo.QuestionVO;
|
||||
|
||||
/**
|
||||
* 题库 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface AnswerService {
|
||||
|
||||
/**
|
||||
* 查询题库 分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param subject 学科
|
||||
* @param section 章节
|
||||
* @param question 问题
|
||||
* @return 题目
|
||||
*/
|
||||
IPage<AnswerVO> findAll(Page<AnswerVO> page, String subject, String section, String question);
|
||||
|
||||
/**
|
||||
* 根据类型和id获取题目
|
||||
*
|
||||
* @param type 类型
|
||||
* @param questionId 题目id
|
||||
* @return 题目信息
|
||||
*/
|
||||
QuestionVO findByIdAndType(String type, Long questionId);
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.entity.ExamManage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考试管理 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface ExamManageService {
|
||||
|
||||
/**
|
||||
* 查询所有考试
|
||||
*
|
||||
* @return 考试列表
|
||||
*/
|
||||
List<ExamManage> findAll();
|
||||
|
||||
/**
|
||||
* 查询考试 分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @return 考试列表
|
||||
*/
|
||||
IPage<ExamManage> findAll(Page<ExamManage> page);
|
||||
|
||||
/**
|
||||
* 根据考试编号查询考试信息
|
||||
*
|
||||
* @param examCode 考试编好
|
||||
* @return 考试信息
|
||||
*/
|
||||
ExamManage findById(Integer examCode);
|
||||
|
||||
/**
|
||||
* 根据考试编号删除
|
||||
*
|
||||
* @param examCode 考试编号
|
||||
*/
|
||||
Integer delete(Integer examCode);
|
||||
|
||||
/**
|
||||
* 更新考试信息
|
||||
*
|
||||
* @param examManage 考试信息
|
||||
*/
|
||||
Integer update(ExamManage examManage);
|
||||
|
||||
/**
|
||||
* 添加考试信息
|
||||
*
|
||||
* @param examManage 考试信息
|
||||
*/
|
||||
Integer add(ExamManage examManage);
|
||||
|
||||
/**
|
||||
* 查询最后一条记录的paperId,返回给前端达到自增效果
|
||||
*
|
||||
* @return 最后一条记录
|
||||
*/
|
||||
ExamManage findOnlyPaperId();
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.shanzhu.oe.entity.FillQuestion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 填空题 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface FillQuestionService {
|
||||
|
||||
/**
|
||||
* 通过试卷id查询问题
|
||||
*
|
||||
* @param paperId 试卷id
|
||||
* @return 问题
|
||||
*/
|
||||
List<FillQuestion> findByIdAndType(Integer paperId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询最后一条填空题
|
||||
*
|
||||
* @return 最后一条填空题
|
||||
*/
|
||||
FillQuestion findOnlyQuestionId();
|
||||
|
||||
/**
|
||||
* 添加填空题
|
||||
*
|
||||
* @param fillQuestion 填空题内容
|
||||
* @return 结果
|
||||
*/
|
||||
Integer add(FillQuestion fillQuestion);
|
||||
|
||||
/**
|
||||
* 通过学科查询
|
||||
*
|
||||
* @param subject 学科查询
|
||||
* @param pageNo 分页数
|
||||
* @return 题目
|
||||
*/
|
||||
List<Integer> findBySubject(String subject,Integer pageNo);
|
||||
|
||||
/**
|
||||
* 编辑填空题
|
||||
*
|
||||
* @param fillQuestion 填空题内容
|
||||
* @return 结果
|
||||
*/
|
||||
Integer edit(FillQuestion fillQuestion);
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.shanzhu.oe.entity.JudgeQuestion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 判断题 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface JudgeQuestionService {
|
||||
|
||||
/**
|
||||
* 通过试卷id查询问题
|
||||
*
|
||||
* @param paperId 试卷id
|
||||
* @return 问题
|
||||
*/
|
||||
List<JudgeQuestion> findByIdAndType(Integer paperId);
|
||||
|
||||
/**
|
||||
* 查询最后一个判断题id
|
||||
*
|
||||
* @return 最后一个判断题
|
||||
*/
|
||||
JudgeQuestion findOnlyQuestionId();
|
||||
|
||||
/**
|
||||
* 添加判断题
|
||||
*
|
||||
* @param judgeQuestion 判断题信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer add(JudgeQuestion judgeQuestion);
|
||||
|
||||
/**
|
||||
* 通过学科查询
|
||||
*
|
||||
* @param subject 学科
|
||||
* @param pageNo 分页数
|
||||
* @return 题目id
|
||||
*/
|
||||
List<Integer> findBySubject(String subject,Integer pageNo);
|
||||
|
||||
/**
|
||||
* 编辑判断题
|
||||
*
|
||||
* @param judgeQuestion 判断题
|
||||
* @return 结果
|
||||
*/
|
||||
Integer edit(JudgeQuestion judgeQuestion);
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.shanzhu.oe.entity.Admin;
|
||||
import com.shanzhu.oe.entity.Student;
|
||||
import com.shanzhu.oe.entity.Teacher;
|
||||
|
||||
/**
|
||||
* 用户登录 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface LoginService {
|
||||
|
||||
/**
|
||||
* 管理员用户登录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return 登录用户信息
|
||||
*/
|
||||
Admin adminLogin(Integer username, String password);
|
||||
|
||||
/**
|
||||
* 教师用户登录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return 登录用户信息
|
||||
*/
|
||||
Teacher teacherLogin(Integer username, String password);
|
||||
|
||||
/**
|
||||
* 学生用户登录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return 登录用户信息
|
||||
*/
|
||||
Student studentLogin(Integer username, String password);
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.entity.Message;
|
||||
|
||||
|
||||
/**
|
||||
* 留言 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface MessageService {
|
||||
|
||||
/**
|
||||
* 留言查询 分页
|
||||
*
|
||||
* @param page 分页内容
|
||||
* @return 留言数据
|
||||
*/
|
||||
IPage<Message> findPage(Page page);
|
||||
|
||||
/**
|
||||
* 通过id查询留言
|
||||
*
|
||||
* @param id 留言id
|
||||
* @return 留言内容
|
||||
*/
|
||||
Message findById(Integer id);
|
||||
|
||||
/**
|
||||
* 删除留言
|
||||
*
|
||||
* @param id 留言id
|
||||
* @return 删除成功数量
|
||||
*/
|
||||
Integer delete(Integer id);
|
||||
|
||||
/**
|
||||
* 更新留言
|
||||
*
|
||||
* @param message 留言信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer update(Message message);
|
||||
|
||||
/**
|
||||
* 添加留言
|
||||
*
|
||||
* @param message 留言信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer add(Message message);
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.shanzhu.oe.entity.MultiQuestion;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 选择题 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface MultiQuestionService {
|
||||
|
||||
/**
|
||||
* 通过试卷id 查询试卷
|
||||
*
|
||||
* @param paperId 试卷id
|
||||
* @return 问题
|
||||
*/
|
||||
List<MultiQuestion> findByIdAndType(Integer paperId);
|
||||
|
||||
/**
|
||||
* 通过id查询选择题
|
||||
*
|
||||
* @return 选择题
|
||||
*/
|
||||
MultiQuestion findOnlyQuestionId();
|
||||
|
||||
/**
|
||||
* 添加选择题
|
||||
*
|
||||
* @param multiQuestion 选择题信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer add(MultiQuestion multiQuestion);
|
||||
|
||||
/**
|
||||
* 通过学科查询
|
||||
*
|
||||
* @param subject 学科
|
||||
* @param pageNo 分页数
|
||||
* @return 题目id
|
||||
*/
|
||||
List<Integer> findBySubject(String subject,Integer pageNo);
|
||||
|
||||
/**
|
||||
* 编辑选择题
|
||||
*
|
||||
* @param multiQuestion 选择题信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer edit(MultiQuestion multiQuestion);
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.shanzhu.oe.entity.Replay;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 回复 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface ReplayService {
|
||||
|
||||
/**
|
||||
* 通过留言id查询回复
|
||||
*
|
||||
* @param messageId 留言id
|
||||
* @return 回复
|
||||
*/
|
||||
List<Replay> findAllById(Integer messageId);
|
||||
|
||||
/**
|
||||
* 删除回复
|
||||
*
|
||||
* @param replayId 回复id
|
||||
* @return 结果
|
||||
*/
|
||||
Integer delete(Integer replayId);
|
||||
|
||||
/**
|
||||
* 更新回复
|
||||
*
|
||||
* @param replay 回复内容
|
||||
* @return 结果
|
||||
*/
|
||||
Integer update(Replay replay);
|
||||
|
||||
/**
|
||||
* 添加回复
|
||||
*
|
||||
* @param replay 回复内容
|
||||
* @return 结果
|
||||
*/
|
||||
Integer add(Replay replay);
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.entity.Score;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分数 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface ScoreService {
|
||||
|
||||
/**
|
||||
* 添加学生成绩
|
||||
*
|
||||
* @param score 学生成绩
|
||||
* @return 考试成绩
|
||||
*/
|
||||
Integer add(Score score);
|
||||
|
||||
/**
|
||||
* 查询所有考试成绩
|
||||
*
|
||||
* @return 考试分数
|
||||
*/
|
||||
List<Score> findAll();
|
||||
|
||||
/**
|
||||
* 查询考试成绩 分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param studentId 学生id
|
||||
* @return 结果
|
||||
*/
|
||||
IPage<Score> findById(Page page, Integer studentId);
|
||||
|
||||
/**
|
||||
* 查询考试成绩 不分页
|
||||
*
|
||||
* @param studentId 学生id
|
||||
* @return 考试成绩
|
||||
*/
|
||||
List<Score> findById(Integer studentId);
|
||||
|
||||
/**
|
||||
* 通过考试编号 查询学生成绩
|
||||
*
|
||||
* @param examCode 考试编号
|
||||
* @return 考试成绩
|
||||
*/
|
||||
List<Score> findByExamCode(Integer examCode);
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.entity.Student;
|
||||
|
||||
/**
|
||||
* 学生 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface StudentService {
|
||||
|
||||
/**
|
||||
* 查询学生 分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param name 学生姓名
|
||||
* @param grade 班级
|
||||
* @param tel 电话
|
||||
* @param institute 学院
|
||||
* @param major 专业
|
||||
* @param clazz 班级
|
||||
* @return 学生列表
|
||||
*/
|
||||
IPage<Student> findAll(
|
||||
Page<Student> page, String name,
|
||||
String grade, String tel,
|
||||
String institute, String major, String clazz
|
||||
);
|
||||
|
||||
/**
|
||||
* 通过学生id查询学生
|
||||
*
|
||||
* @param studentId 学生id
|
||||
* @return 学生
|
||||
*/
|
||||
Student findById(Integer studentId);
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
*
|
||||
* @param studentId 学生id
|
||||
* @return 结果
|
||||
*/
|
||||
Integer deleteById(Integer studentId);
|
||||
|
||||
/**
|
||||
* 更新学生
|
||||
*
|
||||
* @param student 学生信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer update(Student student);
|
||||
|
||||
/**
|
||||
* 添加学生
|
||||
*
|
||||
* @param student 学生信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer add(Student student);
|
||||
|
||||
/**
|
||||
* 更新密码
|
||||
*
|
||||
* @param student 学生信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer updatePwd(Student student);
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.shanzhu.oe.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.entity.Teacher;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 教师 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public interface TeacherService {
|
||||
|
||||
/**
|
||||
* 查询教师 分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @return 教师列表
|
||||
*/
|
||||
IPage<Teacher> findAll(Page<Teacher> page);
|
||||
|
||||
List<Teacher> findAll();
|
||||
|
||||
/**
|
||||
* 通过教师id查询
|
||||
*
|
||||
* @param teacherId 教师id
|
||||
* @return 教师
|
||||
*/
|
||||
Teacher findById(Integer teacherId);
|
||||
|
||||
/**
|
||||
* 删除教师
|
||||
*
|
||||
* @param teacherId 教师id
|
||||
* @return 结果
|
||||
*/
|
||||
Integer deleteById(Integer teacherId);
|
||||
|
||||
/**
|
||||
* 更新教师
|
||||
*
|
||||
* @param teacher 教师信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer update(Teacher teacher);
|
||||
|
||||
/**
|
||||
* 添加教师
|
||||
*
|
||||
* @param teacher 教师信息
|
||||
* @return 结果
|
||||
*/
|
||||
Integer add(Teacher teacher);
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.shanzhu.oe.entity.Admin;
|
||||
import com.shanzhu.oe.mapper.AdminMapper;
|
||||
import com.shanzhu.oe.service.AdminService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 管理员 服务层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AdminServiceImpl implements AdminService {
|
||||
|
||||
private final AdminMapper adminMapper;
|
||||
|
||||
/**
|
||||
* 查询所有管理员
|
||||
*
|
||||
* @return 管理员
|
||||
*/
|
||||
@Override
|
||||
public List<Admin> findAll() {
|
||||
return adminMapper.findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过管理员id查询
|
||||
*
|
||||
* @param adminId 管理员id
|
||||
* @return 管理员
|
||||
*/
|
||||
@Override
|
||||
public Admin findById(Integer adminId) {
|
||||
return adminMapper.findById(adminId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过管理员id删除
|
||||
*
|
||||
* @param adminId 管理员id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer deleteById(Integer adminId) {
|
||||
return adminMapper.deleteById(adminId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新管理员
|
||||
*
|
||||
* @param admin 管理员信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer update(Admin admin) {
|
||||
return adminMapper.update(admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加管理员
|
||||
*
|
||||
* @param admin 管理员信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer add(Admin admin) {
|
||||
return adminMapper.add(admin);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新密码
|
||||
*
|
||||
* @param adminId 管理员id
|
||||
* @param newPsw 新密码
|
||||
* @param oldPsw 旧密码
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Object resetPsw(Integer adminId, String newPsw, String oldPsw) {
|
||||
Admin admin = findById(adminId);
|
||||
|
||||
if(!admin.getPwd().equals(oldPsw)) {
|
||||
return "原密码错误";
|
||||
}
|
||||
admin.setPwd(String.valueOf(newPsw));
|
||||
update(admin);
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.mapper.AnswerMapper;
|
||||
import com.shanzhu.oe.service.AnswerService;
|
||||
import com.shanzhu.oe.vo.AnswerVO;
|
||||
import com.shanzhu.oe.vo.QuestionVO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 题库 服务层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class AnswerServiceImpl implements AnswerService {
|
||||
|
||||
private final AnswerMapper answerMapper;
|
||||
|
||||
/**
|
||||
* 查询题库 分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param subject 学科
|
||||
* @param section 章节
|
||||
* @param question 问题
|
||||
* @return 题目
|
||||
*/
|
||||
@Override
|
||||
public IPage<AnswerVO> findAll(Page<AnswerVO> page, String subject, String section, String question) {
|
||||
subject = (subject.equals("@") ? "" : subject);
|
||||
section = (section.equals("@") ? "" : section);
|
||||
question = (question.equals("@") ? "" : question);
|
||||
return answerMapper.findAll(page, subject, section, question);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型和id获取题目
|
||||
*
|
||||
* @param type 类型
|
||||
* @param questionId 题目id
|
||||
* @return 题目信息
|
||||
*/
|
||||
@Override
|
||||
public QuestionVO findByIdAndType(String type, Long questionId) {
|
||||
QuestionVO questionVO = new QuestionVO();
|
||||
questionVO.setType(type);
|
||||
switch (type) {
|
||||
case "选择题":
|
||||
questionVO.setMultiQuestion(answerMapper.findMultiQuestionById(questionId));
|
||||
break;
|
||||
case "判断题":
|
||||
questionVO.setJudgeQuestion(answerMapper.findJudgeQuestionById(questionId));
|
||||
break;
|
||||
case "填空题":
|
||||
questionVO.setFillQuestion(answerMapper.findFillQuestionById(questionId));
|
||||
break;
|
||||
}
|
||||
return questionVO;
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.entity.ExamManage;
|
||||
import com.shanzhu.oe.mapper.ExamManageMapper;
|
||||
import com.shanzhu.oe.service.ExamManageService;
|
||||
import com.shanzhu.oe.service.PaperService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 考试管理 服务层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ExamManageServiceImpl implements ExamManageService {
|
||||
|
||||
private final ExamManageMapper examManageMapper;
|
||||
|
||||
private final PaperService paperService;
|
||||
|
||||
/**
|
||||
* 查询所有考试
|
||||
*
|
||||
* @return 考试列表
|
||||
*/
|
||||
@Override
|
||||
public List<ExamManage> findAll() {
|
||||
Page<ExamManage> examManage = new Page<>(0, 9999);
|
||||
List<ExamManage> examManageList = examManageMapper.findAll(examManage).getRecords();
|
||||
setMaxScore(examManageList);
|
||||
return examManageList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询考试 分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @return 考试列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<ExamManage> findAll(Page<ExamManage> page) {
|
||||
IPage<ExamManage> iPage = examManageMapper.findAll(page);
|
||||
setMaxScore(iPage.getRecords());
|
||||
return iPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据考试编号查询考试信息
|
||||
*
|
||||
* @param examCode 考试编好
|
||||
* @return 考试信息
|
||||
*/
|
||||
@Override
|
||||
public ExamManage findById(Integer examCode) {
|
||||
ExamManage examManage = examManageMapper.findById(examCode);
|
||||
examManage.setTotalScore(paperService.getMaxScore(examManage.getPaperId()));
|
||||
return examManage;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据考试编号删除
|
||||
*
|
||||
* @param examCode 考试编号
|
||||
*/
|
||||
@Override
|
||||
public Integer delete(Integer examCode) {
|
||||
return examManageMapper.delete(examCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新考试信息
|
||||
*
|
||||
* @param examManage 考试信息
|
||||
*/
|
||||
@Override
|
||||
public Integer update(ExamManage examManage) {
|
||||
return examManageMapper.update(examManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加考试信息
|
||||
*
|
||||
* @param examManage 考试信息
|
||||
*/
|
||||
@Override
|
||||
public Integer add(ExamManage examManage) {
|
||||
return examManageMapper.add(examManage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询最后一条记录的paperId,返回给前端达到自增效果
|
||||
*
|
||||
* @return 最后一条记录
|
||||
*/
|
||||
@Override
|
||||
public ExamManage findOnlyPaperId() {
|
||||
return examManageMapper.findOnlyPaperId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置最高分
|
||||
*
|
||||
* @param examManageList
|
||||
*/
|
||||
private void setMaxScore(List<ExamManage> examManageList) {
|
||||
for (ExamManage examManage : examManageList) {
|
||||
examManage.setTotalScore(paperService.getMaxScore(examManage.getPaperId()));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.shanzhu.oe.entity.FillQuestion;
|
||||
import com.shanzhu.oe.mapper.FillQuestionMapper;
|
||||
import com.shanzhu.oe.service.FillQuestionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 填空题 服务层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class FillQuestionServiceImpl implements FillQuestionService {
|
||||
|
||||
private final FillQuestionMapper fillQuestionMapper;
|
||||
|
||||
/**
|
||||
* 通过试卷id查询问题
|
||||
*
|
||||
* @param paperId 试卷id
|
||||
* @return 问题
|
||||
*/
|
||||
@Override
|
||||
public List<FillQuestion> findByIdAndType(Integer paperId) {
|
||||
return fillQuestionMapper.findByIdAndType(paperId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询最后一条填空题
|
||||
*
|
||||
* @return 最后一条填空题
|
||||
*/
|
||||
@Override
|
||||
public FillQuestion findOnlyQuestionId() {
|
||||
return fillQuestionMapper.findOnlyQuestionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加填空题
|
||||
*
|
||||
* @param fillQuestion 填空题内容
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer add(FillQuestion fillQuestion) {
|
||||
return fillQuestionMapper.add(fillQuestion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过学科查询
|
||||
*
|
||||
* @param subject 学科查询
|
||||
* @param pageNo 分页数
|
||||
* @return 题目
|
||||
*/
|
||||
@Override
|
||||
public List<Integer> findBySubject(String subject, Integer pageNo) {
|
||||
return fillQuestionMapper.findBySubject(subject,pageNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑填空题
|
||||
*
|
||||
* @param fillQuestion 填空题内容
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer edit(FillQuestion fillQuestion) {
|
||||
return fillQuestionMapper.edit(fillQuestion);
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.shanzhu.oe.entity.JudgeQuestion;
|
||||
import com.shanzhu.oe.mapper.JudgeQuestionMapper;
|
||||
import com.shanzhu.oe.service.JudgeQuestionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 判断题 服务层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class JudgeQuestionServiceImpl implements JudgeQuestionService {
|
||||
|
||||
private final JudgeQuestionMapper judgeQuestionMapper;
|
||||
|
||||
/**
|
||||
* 通过试卷id查询问题
|
||||
*
|
||||
* @param paperId 试卷id
|
||||
* @return 问题
|
||||
*/
|
||||
@Override
|
||||
public List<JudgeQuestion> findByIdAndType(Integer paperId) {
|
||||
return judgeQuestionMapper.findByIdAndType(paperId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询最后一个判断题id
|
||||
*
|
||||
* @return 最后一个判断题
|
||||
*/
|
||||
@Override
|
||||
public JudgeQuestion findOnlyQuestionId() {
|
||||
return judgeQuestionMapper.findOnlyQuestionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加判断题
|
||||
*
|
||||
* @param judgeQuestion 判断题信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer add(JudgeQuestion judgeQuestion) {
|
||||
return judgeQuestionMapper.add(judgeQuestion);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 通过学科查询
|
||||
* @param subject 学科
|
||||
* @param pageNo 分页数
|
||||
* @return 题目id
|
||||
*/
|
||||
@Override
|
||||
public List<Integer> findBySubject(String subject, Integer pageNo) {
|
||||
return judgeQuestionMapper.findBySubject(subject,pageNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑判断题
|
||||
*
|
||||
* @param judgeQuestion 判断题
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer edit(JudgeQuestion judgeQuestion) {
|
||||
return judgeQuestionMapper.edit(judgeQuestion);
|
||||
}
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.shanzhu.oe.entity.Admin;
|
||||
import com.shanzhu.oe.entity.Student;
|
||||
import com.shanzhu.oe.entity.Teacher;
|
||||
import com.shanzhu.oe.mapper.LoginMapper;
|
||||
import com.shanzhu.oe.service.LoginService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 用户登录 服务层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LoginServiceImpl implements LoginService {
|
||||
|
||||
private final LoginMapper loginMapper;
|
||||
|
||||
/**
|
||||
* 管理员用户登录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return 登录用户信息
|
||||
*/
|
||||
@Override
|
||||
public Admin adminLogin(Integer username, String password) {
|
||||
return loginMapper.adminLogin(username,password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 教师登录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return 登录用户信息
|
||||
*/
|
||||
@Override
|
||||
public Teacher teacherLogin(Integer username, String password) {
|
||||
return loginMapper.teacherLogin(username,password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 学生登录
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param password 密码
|
||||
* @return 登录用户信息
|
||||
*/
|
||||
@Override
|
||||
public Student studentLogin(Integer username, String password) {
|
||||
return loginMapper.studentLogin(username,password);
|
||||
}
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.entity.Message;
|
||||
import com.shanzhu.oe.mapper.MessageMapper;
|
||||
import com.shanzhu.oe.service.MessageService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* 留言 控制层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MessageServiceImpl implements MessageService {
|
||||
|
||||
private final MessageMapper messageMapper;
|
||||
|
||||
/**
|
||||
* 留言查询 分页
|
||||
*
|
||||
* @param page 分页内容
|
||||
* @return 留言数据
|
||||
*/
|
||||
@Override
|
||||
public IPage<Message> findPage(Page page) {
|
||||
return messageMapper.findAll(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询留言
|
||||
*
|
||||
* @param id 留言id
|
||||
* @return 留言内容
|
||||
*/
|
||||
@Override
|
||||
public Message findById(Integer id) {
|
||||
return messageMapper.findById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除留言
|
||||
*
|
||||
* @param id 留言id
|
||||
* @return 删除成功数量
|
||||
*/
|
||||
@Override
|
||||
public Integer delete(Integer id) {
|
||||
return messageMapper.delete(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新留言
|
||||
*
|
||||
* @param message 留言信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer update(Message message) {
|
||||
return messageMapper.update(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加留言
|
||||
*
|
||||
* @param message 留言信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer add(Message message) {
|
||||
return messageMapper.add(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.shanzhu.oe.entity.MultiQuestion;
|
||||
import com.shanzhu.oe.mapper.MultiQuestionMapper;
|
||||
import com.shanzhu.oe.service.MultiQuestionService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 选择题 服务层
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MultiQuestionServiceImpl implements MultiQuestionService {
|
||||
|
||||
private final MultiQuestionMapper multiQuestionMapper;
|
||||
|
||||
/**
|
||||
* 通过试卷id 查询试卷
|
||||
*
|
||||
* @param paperId 试卷id
|
||||
* @return 问题
|
||||
*/
|
||||
@Override
|
||||
public List<MultiQuestion> findByIdAndType(Integer paperId) {
|
||||
return multiQuestionMapper.findByIdAndType(paperId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询选择题
|
||||
*
|
||||
* @return 选择题
|
||||
*/
|
||||
@Override
|
||||
public MultiQuestion findOnlyQuestionId() {
|
||||
return multiQuestionMapper.findOnlyQuestionId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加选择题
|
||||
*
|
||||
* @param multiQuestion 选择题信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer add(MultiQuestion multiQuestion) {
|
||||
return multiQuestionMapper.add(multiQuestion);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过学科查询
|
||||
*
|
||||
* @param subject 学科
|
||||
* @param pageNo 分页数
|
||||
* @return 题目id
|
||||
*/
|
||||
@Override
|
||||
public List<Integer> findBySubject(String subject, Integer pageNo) {
|
||||
return multiQuestionMapper.findBySubject(subject,pageNo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑选择题
|
||||
*
|
||||
* @param multiQuestion 选择题信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer edit(MultiQuestion multiQuestion) {
|
||||
return multiQuestionMapper.edit(multiQuestion);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.shanzhu.oe.entity.Replay;
|
||||
import com.shanzhu.oe.mapper.ReplayMapper;
|
||||
import com.shanzhu.oe.service.ReplayService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 回复 服务层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ReplayServiceImpl implements ReplayService {
|
||||
|
||||
private final ReplayMapper replayMapper;
|
||||
|
||||
/**
|
||||
* 通过留言id查询回复
|
||||
*
|
||||
* @param messageId 留言id
|
||||
* @return 回复
|
||||
*/
|
||||
@Override
|
||||
public List<Replay> findAllById(Integer messageId) {
|
||||
return replayMapper.findAllById(messageId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除回复
|
||||
*
|
||||
* @param replayId 回复id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer delete(Integer replayId) {
|
||||
return replayMapper.delete(replayId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新回复
|
||||
*
|
||||
* @param replay 回复内容
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer update(Replay replay) {
|
||||
return replayMapper.update(replay);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加回复
|
||||
*
|
||||
* @param replay 回复内容
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer add(Replay replay) {
|
||||
return replayMapper.add(replay);
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.entity.Score;
|
||||
import com.shanzhu.oe.mapper.ScoreMapper;
|
||||
import com.shanzhu.oe.service.ScoreService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分数 服务层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ScoreServiceImpl implements ScoreService {
|
||||
|
||||
private final ScoreMapper scoreMapper;
|
||||
|
||||
/**
|
||||
* 添加学生成绩
|
||||
*
|
||||
* @param score 学生成绩
|
||||
* @return 考试成绩
|
||||
*/
|
||||
@Override
|
||||
public Integer add(Score score) {
|
||||
return scoreMapper.add(score);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有考试成绩
|
||||
*
|
||||
* @return 考试成绩
|
||||
*/
|
||||
@Override
|
||||
public List<Score> findAll() {
|
||||
return scoreMapper.findAll();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询考试成绩 分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param studentId 学生id
|
||||
* @return 考试成绩
|
||||
*/
|
||||
@Override
|
||||
public IPage<Score> findById(Page page, Integer studentId) {
|
||||
return scoreMapper.findById(page, studentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询考试成绩 不分页
|
||||
*
|
||||
* @param studentId 学生id
|
||||
* @return 考试成绩
|
||||
*/
|
||||
@Override
|
||||
public List<Score> findById(Integer studentId) {
|
||||
Page<Score> scorePage = new Page<>(0, 9999);
|
||||
return scoreMapper.findById(scorePage, studentId).getRecords();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过考试编号 查询学生成绩
|
||||
*
|
||||
* @param examCode 考试编号
|
||||
* @return 考试成绩
|
||||
*/
|
||||
@Override
|
||||
public List<Score> findByExamCode(Integer examCode) {
|
||||
return scoreMapper.findByExamCode(examCode);
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.entity.Student;
|
||||
import com.shanzhu.oe.mapper.StudentMapper;
|
||||
import com.shanzhu.oe.service.StudentService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 学生 服务层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class StudentServiceImpl implements StudentService {
|
||||
|
||||
private final StudentMapper studentMapper;
|
||||
|
||||
/**
|
||||
* 查询学生 分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param name 学生姓名
|
||||
* @param grade 班级
|
||||
* @param tel 电话
|
||||
* @param institute 学院
|
||||
* @param major 专业
|
||||
* @param clazz 班级
|
||||
* @return 学生列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<Student> findAll(
|
||||
Page<Student> page, String name, String grade,
|
||||
String tel, String institute, String major, String clazz
|
||||
) {
|
||||
name = ("@".equals(name) ? "" : name);
|
||||
grade = ("@".equals(grade) ? "" : grade);
|
||||
tel = ("@".equals(tel) ? "" : tel);
|
||||
institute = ("@".equals(institute) ? "" : institute);
|
||||
major = ("@".equals(major) ? "" : major);
|
||||
clazz = ("@".equals(clazz) ? "" : clazz);
|
||||
return studentMapper.findAll(page, name, grade, tel, institute, major, clazz);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过学生id查询学生
|
||||
*
|
||||
* @param studentId 学生id
|
||||
* @return 学生
|
||||
*/
|
||||
@Override
|
||||
public Student findById(Integer studentId) {
|
||||
return studentMapper.findById(studentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除学生
|
||||
*
|
||||
* @param studentId 学生id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer deleteById(Integer studentId) {
|
||||
return studentMapper.deleteById(studentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新学生
|
||||
*
|
||||
* @param student 学生信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer update(Student student) {
|
||||
return studentMapper.update(student);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加学生
|
||||
*
|
||||
* @param student 学生信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer add(Student student) {
|
||||
return studentMapper.add(student);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新密码
|
||||
*
|
||||
* @param student 学生信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer updatePwd(Student student) {
|
||||
return studentMapper.updatePwd(student);
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.shanzhu.oe.serviceimpl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.shanzhu.oe.entity.Teacher;
|
||||
import com.shanzhu.oe.mapper.TeacherMapper;
|
||||
import com.shanzhu.oe.service.TeacherService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 教师 服务层实现类
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TeacherServiceImpl implements TeacherService {
|
||||
|
||||
private final TeacherMapper teacherMapper;
|
||||
|
||||
/**
|
||||
* 查询教师 分页
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @return 教师列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<Teacher> findAll(Page<Teacher> page) {
|
||||
return teacherMapper.findAll(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Teacher> findAll() {
|
||||
Page<Teacher> teacherPage = new Page<>(0,9999);
|
||||
return teacherMapper.findAll(teacherPage).getRecords();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过教师id查询
|
||||
*
|
||||
* @param teacherId 教师id
|
||||
* @return 教师
|
||||
*/
|
||||
@Override
|
||||
public Teacher findById(Integer teacherId) {
|
||||
return teacherMapper.findById(teacherId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除教师
|
||||
*
|
||||
* @param teacherId 教师id
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer deleteById(Integer teacherId) {
|
||||
return teacherMapper.deleteById(teacherId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新教师
|
||||
*
|
||||
* @param teacher 教师信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer update(Teacher teacher) {
|
||||
return teacherMapper.update(teacher);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加教师
|
||||
*
|
||||
* @param teacher 教师信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public Integer add(Teacher teacher) {
|
||||
teacher.setRole("1");
|
||||
return teacherMapper.add(teacher);
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.shanzhu.oe.util;
|
||||
|
||||
import com.shanzhu.oe.common.R;
|
||||
|
||||
/**
|
||||
* 对象 {@link R} 数据处理工具
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
public class ApiResultHandler {
|
||||
|
||||
public static R success(Object object) {
|
||||
R r = new R();
|
||||
r.setData(object);
|
||||
r.setCode(200);
|
||||
r.setMessage("请求成功");
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R success() {
|
||||
return success(null);
|
||||
}
|
||||
|
||||
public static <T> R buildApiResult(Integer code, String message, T data) {
|
||||
R r = new R();
|
||||
r.setCode(code);
|
||||
r.setMessage(message);
|
||||
r.setData(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package com.shanzhu.oe.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 题库 接口返回对象
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class AnswerVO {
|
||||
|
||||
/**
|
||||
* 题目id
|
||||
*/
|
||||
private Long questionId;
|
||||
|
||||
/**
|
||||
* 题目
|
||||
*/
|
||||
private String question;
|
||||
|
||||
/**
|
||||
* 科目
|
||||
*/
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 分数
|
||||
*/
|
||||
private String score;
|
||||
|
||||
/**
|
||||
* 章节
|
||||
*/
|
||||
private String section;
|
||||
|
||||
/**
|
||||
* 难度等级
|
||||
*/
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.shanzhu.oe.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 组卷
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class Item {
|
||||
|
||||
/**
|
||||
* 科目
|
||||
*/
|
||||
private String subject;
|
||||
|
||||
/**
|
||||
* 试卷编号
|
||||
*/
|
||||
private Integer paperId;
|
||||
|
||||
/**
|
||||
* 选择题数量
|
||||
*/
|
||||
private Integer changeNumber;
|
||||
|
||||
/**
|
||||
* 填空题数量
|
||||
*/
|
||||
private Integer fillNumber;
|
||||
|
||||
/**
|
||||
* 判断题数量
|
||||
*/
|
||||
private Integer judgeNumber;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.shanzhu.oe.vo;
|
||||
|
||||
import com.shanzhu.oe.entity.FillQuestion;
|
||||
import com.shanzhu.oe.entity.JudgeQuestion;
|
||||
import com.shanzhu.oe.entity.MultiQuestion;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 题目 接口返回对象
|
||||
*
|
||||
* @author: ShanZhu
|
||||
* @date: 2023-11-20
|
||||
*/
|
||||
@Data
|
||||
public class QuestionVO {
|
||||
|
||||
/**
|
||||
* 题目类型
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 填空题
|
||||
*/
|
||||
private FillQuestion fillQuestion;
|
||||
|
||||
/**
|
||||
* 判断题
|
||||
*/
|
||||
private JudgeQuestion judgeQuestion;
|
||||
|
||||
/**
|
||||
* 选择题
|
||||
*/
|
||||
private MultiQuestion multiQuestion;
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"modules": false,
|
||||
"targets": {
|
||||
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
|
||||
}
|
||||
}],
|
||||
"stage-2"
|
||||
],
|
||||
"plugins": ["transform-vue-jsx", "transform-runtime"]
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
@ -0,0 +1,25 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files`
|
||||
`
|
||||
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
@ -0,0 +1 @@
|
||||
registry=https://registry.npm.taobao.org/
|
@ -0,0 +1,10 @@
|
||||
// https://github.com/michael-ciniawsky/postcss-load-config
|
||||
|
||||
module.exports = {
|
||||
"plugins": {
|
||||
"postcss-import": {},
|
||||
"postcss-url": {},
|
||||
// to edit target browsers: use "browserslist" field in package.json
|
||||
"autoprefixer": {}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
'use strict'
|
||||
require('./check-versions')()
|
||||
|
||||
process.env.NODE_ENV = 'production'
|
||||
|
||||
const ora = require('ora')
|
||||
const rm = require('rimraf')
|
||||
const path = require('path')
|
||||
const chalk = require('chalk')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const webpackConfig = require('./webpack.prod.conf')
|
||||
|
||||
const spinner = ora('building for production...')
|
||||
spinner.start()
|
||||
|
||||
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => {
|
||||
if (err) throw err
|
||||
webpack(webpackConfig, (err, stats) => {
|
||||
spinner.stop()
|
||||
if (err) throw err
|
||||
process.stdout.write(stats.toString({
|
||||
colors: true,
|
||||
modules: false,
|
||||
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
|
||||
chunks: false,
|
||||
chunkModules: false
|
||||
}) + '\n\n')
|
||||
|
||||
if (stats.hasErrors()) {
|
||||
console.log(chalk.red(' Build failed with errors.\n'))
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
console.log(chalk.cyan(' Build complete.\n'))
|
||||
console.log(chalk.yellow(
|
||||
' Tip: built files are meant to be served over an HTTP server.\n' +
|
||||
' Opening index.html over file:// won\'t work.\n'
|
||||
))
|
||||
})
|
||||
})
|
@ -0,0 +1,54 @@
|
||||
'use strict'
|
||||
const chalk = require('chalk')
|
||||
const semver = require('semver')
|
||||
const packageConfig = require('../package.json')
|
||||
const shell = require('shelljs')
|
||||
|
||||
function exec (cmd) {
|
||||
return require('child_process').execSync(cmd).toString().trim()
|
||||
}
|
||||
|
||||
const versionRequirements = [
|
||||
{
|
||||
name: 'node',
|
||||
currentVersion: semver.clean(process.version),
|
||||
versionRequirement: packageConfig.engines.node
|
||||
}
|
||||
]
|
||||
|
||||
if (shell.which('npm')) {
|
||||
versionRequirements.push({
|
||||
name: 'npm',
|
||||
currentVersion: exec('npm --version'),
|
||||
versionRequirement: packageConfig.engines.npm
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = function () {
|
||||
const warnings = []
|
||||
|
||||
for (let i = 0; i < versionRequirements.length; i++) {
|
||||
const mod = versionRequirements[i]
|
||||
|
||||
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
|
||||
warnings.push(mod.name + ': ' +
|
||||
chalk.red(mod.currentVersion) + ' should be ' +
|
||||
chalk.green(mod.versionRequirement)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (warnings.length) {
|
||||
console.log('')
|
||||
console.log(chalk.yellow('To use this template, you must update following to modules:'))
|
||||
console.log()
|
||||
|
||||
for (let i = 0; i < warnings.length; i++) {
|
||||
const warning = warnings[i]
|
||||
console.log(' ' + warning)
|
||||
}
|
||||
|
||||
console.log()
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 34 KiB |
@ -0,0 +1,99 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const config = require('../config')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const packageConfig = require('../package.json')
|
||||
|
||||
exports.assetsPath = function (_path) {
|
||||
const assetsSubDirectory = process.env.NODE_ENV === 'production'
|
||||
? config.build.assetsSubDirectory
|
||||
: config.dev.assetsSubDirectory
|
||||
|
||||
return path.posix.join(assetsSubDirectory, _path)
|
||||
}
|
||||
|
||||
exports.cssLoaders = function (options) {
|
||||
options = options || {}
|
||||
|
||||
const cssLoader = {
|
||||
loader: 'css-loader',
|
||||
options: {
|
||||
sourceMap: options.sourceMap
|
||||
}
|
||||
}
|
||||
|
||||
const postcssLoader = {
|
||||
loader: 'postcss-loader',
|
||||
options: {
|
||||
sourceMap: options.sourceMap
|
||||
}
|
||||
}
|
||||
|
||||
// generate loader string to be used with extract text plugin
|
||||
function generateLoaders (loader, loaderOptions) {
|
||||
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader]
|
||||
|
||||
if (loader) {
|
||||
loaders.push({
|
||||
loader: loader + '-loader',
|
||||
options: Object.assign({}, loaderOptions, {
|
||||
sourceMap: options.sourceMap
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Extract CSS when that option is specified
|
||||
// (which is the case during production build)
|
||||
if (options.extract) {
|
||||
return ExtractTextPlugin.extract({
|
||||
use: loaders,
|
||||
fallback: 'vue-style-loader'
|
||||
})
|
||||
} else {
|
||||
return ['vue-style-loader'].concat(loaders)
|
||||
}
|
||||
}
|
||||
|
||||
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
|
||||
return {
|
||||
css: generateLoaders(),
|
||||
postcss: generateLoaders(),
|
||||
less: generateLoaders('less'),
|
||||
stylus: generateLoaders('stylus'),
|
||||
styl: generateLoaders('stylus')
|
||||
}
|
||||
}
|
||||
|
||||
// Generate loaders for standalone style files (outside of .vue)
|
||||
exports.styleLoaders = function (options) {
|
||||
const output = []
|
||||
const loaders = exports.cssLoaders(options)
|
||||
|
||||
for (const extension in loaders) {
|
||||
const loader = loaders[extension]
|
||||
output.push({
|
||||
test: new RegExp('\\.' + extension + '$'),
|
||||
use: loader
|
||||
})
|
||||
}
|
||||
|
||||
return output
|
||||
}
|
||||
|
||||
exports.createNotifierCallback = () => {
|
||||
const notifier = require('node-notifier')
|
||||
|
||||
return (severity, errors) => {
|
||||
if (severity !== 'error') return
|
||||
|
||||
const error = errors[0]
|
||||
const filename = error.file && error.file.split('!').pop()
|
||||
|
||||
notifier.notify({
|
||||
title: packageConfig.name,
|
||||
message: severity + ': ' + error.name,
|
||||
subtitle: filename || '',
|
||||
icon: path.join(__dirname, 'logo.png')
|
||||
})
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
'use strict'
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const isProduction = process.env.NODE_ENV === 'production'
|
||||
const sourceMapEnabled = isProduction
|
||||
? config.build.productionSourceMap
|
||||
: config.dev.cssSourceMap
|
||||
|
||||
module.exports = {
|
||||
loaders: utils.cssLoaders({
|
||||
sourceMap: sourceMapEnabled,
|
||||
extract: isProduction
|
||||
}),
|
||||
cssSourceMap: sourceMapEnabled,
|
||||
cacheBusting: config.dev.cacheBusting,
|
||||
transformToRequire: {
|
||||
video: ['src', 'poster'],
|
||||
source: 'src',
|
||||
img: 'src',
|
||||
image: 'xlink:href'
|
||||
}
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const config = require('../config')
|
||||
const vueLoaderConfig = require('./vue-loader.conf')
|
||||
|
||||
function resolve (dir) {
|
||||
return path.join(__dirname, '..', dir)
|
||||
}
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
context: path.resolve(__dirname, '../'),
|
||||
entry: {
|
||||
app: './src/main.js'
|
||||
},
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
filename: '[name].js',
|
||||
publicPath: process.env.NODE_ENV === 'production'
|
||||
? config.build.assetsPublicPath
|
||||
: config.dev.assetsPublicPath
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.js', '.vue', '.json'],
|
||||
alias: {
|
||||
'vue$': 'vue/dist/vue.esm.js',
|
||||
'@': resolve('src'),
|
||||
}
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.less$/,
|
||||
loader: "style-loader!css-loader!less-loader"
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: vueLoaderConfig
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
loader: 'babel-loader',
|
||||
include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')]
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('img/[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('media/[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 10000,
|
||||
name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
|
||||
}
|
||||
},
|
||||
// {
|
||||
// test: /node_modules[\\\/]vis[\\\/].*\.js$/,
|
||||
// loader: 'babel-loader',
|
||||
// query: {
|
||||
// cacheDirectory: true,
|
||||
// presets: [ "babel-preset-es2015" ].map(require.resolve),
|
||||
// plugins: [
|
||||
// "transform-es3-property-literals", // #2452
|
||||
// "transform-es3-member-expression-literals", // #2566
|
||||
// "transform-runtime" // #2566
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
]
|
||||
},
|
||||
node: {
|
||||
// prevent webpack from injecting useless setImmediate polyfill because Vue
|
||||
// source contains it (although only uses it if it's native).
|
||||
setImmediate: false,
|
||||
// prevent webpack from injecting mocks to Node native modules
|
||||
// that does not make sense for the client
|
||||
dgram: 'empty',
|
||||
fs: 'empty',
|
||||
net: 'empty',
|
||||
tls: 'empty',
|
||||
child_process: 'empty'
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
'use strict'
|
||||
const utils = require('./utils')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const merge = require('webpack-merge')
|
||||
const path = require('path')
|
||||
const baseWebpackConfig = require('./webpack.base.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
|
||||
const portfinder = require('portfinder')
|
||||
|
||||
const HOST = process.env.HOST
|
||||
const PORT = process.env.PORT && Number(process.env.PORT)
|
||||
|
||||
const devWebpackConfig = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true })
|
||||
},
|
||||
// cheap-module-eval-source-map is faster for development
|
||||
devtool: config.dev.devtool,
|
||||
|
||||
// these devServer options should be customized in /config/index.js
|
||||
devServer: {
|
||||
clientLogLevel: 'warning',
|
||||
historyApiFallback: {
|
||||
rewrites: [
|
||||
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') },
|
||||
],
|
||||
},
|
||||
hot: true,
|
||||
contentBase: false, // since we use CopyWebpackPlugin.
|
||||
compress: true,
|
||||
host: HOST || config.dev.host,
|
||||
port: PORT || config.dev.port,
|
||||
open: config.dev.autoOpenBrowser,
|
||||
overlay: config.dev.errorOverlay
|
||||
? { warnings: false, errors: true }
|
||||
: false,
|
||||
publicPath: config.dev.assetsPublicPath,
|
||||
proxy: config.dev.proxyTable,
|
||||
quiet: true, // necessary for FriendlyErrorsPlugin
|
||||
watchOptions: {
|
||||
poll: config.dev.poll,
|
||||
}
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': require('../config/dev.env')
|
||||
}),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
|
||||
new webpack.NoEmitOnErrorsPlugin(),
|
||||
// https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({
|
||||
filename: 'index.html',
|
||||
template: 'index.html',
|
||||
inject: true
|
||||
}),
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
to: config.dev.assetsSubDirectory,
|
||||
ignore: ['.*']
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
||||
module.exports = new Promise((resolve, reject) => {
|
||||
portfinder.basePort = process.env.PORT || config.dev.port
|
||||
portfinder.getPort((err, port) => {
|
||||
if (err) {
|
||||
reject(err)
|
||||
} else {
|
||||
// publish the new Port, necessary for e2e tests
|
||||
process.env.PORT = port
|
||||
// add port to devServer config
|
||||
devWebpackConfig.devServer.port = port
|
||||
|
||||
// Add FriendlyErrorsPlugin
|
||||
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({
|
||||
compilationSuccessInfo: {
|
||||
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`],
|
||||
},
|
||||
onErrors: config.dev.notifyOnErrors
|
||||
? utils.createNotifierCallback()
|
||||
: undefined
|
||||
}))
|
||||
|
||||
resolve(devWebpackConfig)
|
||||
}
|
||||
})
|
||||
})
|
@ -0,0 +1,145 @@
|
||||
'use strict'
|
||||
const path = require('path')
|
||||
const utils = require('./utils')
|
||||
const webpack = require('webpack')
|
||||
const config = require('../config')
|
||||
const merge = require('webpack-merge')
|
||||
const baseWebpackConfig = require('./webpack.base.conf')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin')
|
||||
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
|
||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
|
||||
|
||||
const env = require('../config/prod.env')
|
||||
|
||||
const webpackConfig = merge(baseWebpackConfig, {
|
||||
module: {
|
||||
rules: utils.styleLoaders({
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
extract: true,
|
||||
usePostCSS: true
|
||||
})
|
||||
},
|
||||
devtool: config.build.productionSourceMap ? config.build.devtool : false,
|
||||
output: {
|
||||
path: config.build.assetsRoot,
|
||||
filename: utils.assetsPath('js/[name].[chunkhash].js'),
|
||||
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
|
||||
},
|
||||
plugins: [
|
||||
// http://vuejs.github.io/vue-loader/en/workflow/production.html
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': env
|
||||
}),
|
||||
new UglifyJsPlugin({
|
||||
uglifyOptions: {
|
||||
compress: {
|
||||
warnings: false
|
||||
}
|
||||
},
|
||||
sourceMap: config.build.productionSourceMap,
|
||||
parallel: true
|
||||
}),
|
||||
// extract css into its own file
|
||||
new ExtractTextPlugin({
|
||||
filename: utils.assetsPath('css/[name].[contenthash].css'),
|
||||
// Setting the following option to `false` will not extract CSS from codesplit chunks.
|
||||
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
|
||||
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
|
||||
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
|
||||
allChunks: true,
|
||||
}),
|
||||
// Compress extracted CSS. We are using this plugin so that possible
|
||||
// duplicated CSS from different components can be deduped.
|
||||
new OptimizeCSSPlugin({
|
||||
cssProcessorOptions: config.build.productionSourceMap
|
||||
? { safe: true, map: { inline: false } }
|
||||
: { safe: true }
|
||||
}),
|
||||
// generate dist index.html with correct asset hash for caching.
|
||||
// you can customize output by editing /index.html
|
||||
// see https://github.com/ampedandwired/html-webpack-plugin
|
||||
new HtmlWebpackPlugin({
|
||||
filename: config.build.index,
|
||||
template: 'index.html',
|
||||
inject: true,
|
||||
minify: {
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
removeAttributeQuotes: true
|
||||
// more options:
|
||||
// https://github.com/kangax/html-minifier#options-quick-reference
|
||||
},
|
||||
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
|
||||
chunksSortMode: 'dependency'
|
||||
}),
|
||||
// keep module.id stable when vendor modules does not change
|
||||
new webpack.HashedModuleIdsPlugin(),
|
||||
// enable scope hoisting
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
// split vendor js into its own file
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
minChunks (module) {
|
||||
// any required modules inside node_modules are extracted to vendor
|
||||
return (
|
||||
module.resource &&
|
||||
/\.js$/.test(module.resource) &&
|
||||
module.resource.indexOf(
|
||||
path.join(__dirname, '../node_modules')
|
||||
) === 0
|
||||
)
|
||||
}
|
||||
}),
|
||||
// extract webpack runtime and module manifest to its own file in order to
|
||||
// prevent vendor hash from being updated whenever app bundle is updated
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'manifest',
|
||||
minChunks: Infinity
|
||||
}),
|
||||
// This instance extracts shared chunks from code splitted chunks and bundles them
|
||||
// in a separate chunk, similar to the vendor chunk
|
||||
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'app',
|
||||
async: 'vendor-async',
|
||||
children: true,
|
||||
minChunks: 3
|
||||
}),
|
||||
|
||||
// copy custom static assets
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(__dirname, '../static'),
|
||||
to: config.build.assetsSubDirectory,
|
||||
ignore: ['.*']
|
||||
}
|
||||
])
|
||||
]
|
||||
})
|
||||
|
||||
if (config.build.productionGzip) {
|
||||
const CompressionWebpackPlugin = require('compression-webpack-plugin')
|
||||
|
||||
webpackConfig.plugins.push(
|
||||
new CompressionWebpackPlugin({
|
||||
asset: '[path].gz[query]',
|
||||
algorithm: 'gzip',
|
||||
test: new RegExp(
|
||||
'\\.(' +
|
||||
config.build.productionGzipExtensions.join('|') +
|
||||
')$'
|
||||
),
|
||||
threshold: 10240,
|
||||
minRatio: 0.8
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
if (config.build.bundleAnalyzerReport) {
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin
|
||||
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
|
||||
}
|
||||
|
||||
module.exports = webpackConfig
|
@ -0,0 +1,7 @@
|
||||
'use strict'
|
||||
const merge = require('webpack-merge')
|
||||
const prodEnv = require('./prod.env')
|
||||
|
||||
module.exports = merge(prodEnv, {
|
||||
NODE_ENV: '"development"'
|
||||
})
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue