基于javaweb+mysql的springboot在线学习系统在线学习平台(学生、教师、管理员)(java+springboot+maven+vue+elementui+mysql)
私信源码获取及调试交流
运行环境
Java≥8、MySQL≥5.7、Node.js≥10
开发工具
后端:eclipse/idea/myeclipse/sts等均可配置运行
前端:WebStorm/VSCode/HBuilderX等均可
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
管理员:
老师:
学生:
基于javaweb的SpringBoot在线学习系统在线学习平台(学生、教师、管理员)(java+springboot+maven+vue+elementui+mysql)
登录页:
http://localhost:8080/#/login
管理员
admin 123456
老师
t1 123456
学生
s1 123456
*/
@RequestMapping("/login")
public Result login(@RequestBody LoginVo loginVo) {
List<HashMap> users = userService.login(loginVo);
if (users.size() < 1) {
return Result.failure("登录失败");
}
return Result.success(users.get(0));
}
/**
* 修改
*/
@RequestMapping("/updatePassword")
public Result updatePassword(@RequestBody UserVo userVo) {
UserEntity byId = userService.getById(userVo.getId());
if (userVo.getPassword().equals(byId.getPassword())){
UserEntity userEntity = new UserEntity();
userEntity.setId(userVo.getId());
userEntity.setPassword(userVo.getNewPassword());
boolean updateById = userService.updateById(userEntity);
if (updateById){
return Result.successCode();
}
return Result.failureCode();
}
return Result.failureCode();
}
}
* @email ${email}
*/
@RestController
@RequestMapping("study/userDoExercise")
public class UserDoExerciseController {
@Autowired
private UserDoExerciseService userDoExerciseService;
/**
* 列表
*/
@RequestMapping("/list")
public Result list(@RequestBody UserDoExerciseVo userDoExerciseVo) {
userDoExerciseVo.setPage((userDoExerciseVo.getPage() - 1) * userDoExerciseVo.getPageSize());
Map<String, Object> page = userDoExerciseService.queryPage(userDoExerciseVo);
return Result.success(page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public Result info(@PathVariable("id") Integer id) {
UserDoExerciseEntity userDoExercise = userDoExerciseService.getById(id);
return Result.success(userDoExercise);
}
/**
* 保存
*/
@RequestMapping("/save")
public Result save(@RequestBody UserDoExerciseVo userDoExerciseVo) {
UserDoExerciseEntity userDoExerciseEntity = new UserDoExerciseEntity();
userDoExerciseEntity.setExerciseId(userDoExerciseVo.getExerciseId());
userDoExerciseEntity.setReply(userDoExerciseVo.getContent());
userDoExerciseEntity.setUserId(userDoExerciseVo.getUserId());
boolean save = userDoExerciseService.save(userDoExerciseEntity);
if (save){
return Result.successCode();
}
return Result.failureCode();
private VideosService videosService;
/**
* 分页查询
*/
@RequestMapping("/list")
public Result list(@RequestBody VideoTotalVo videoTotalVo) {
videoTotalVo.setPage((videoTotalVo.getPage() - 1) * videoTotalVo.getPageSize());
Map<String, Object> page = videoTotalService.queryPage(videoTotalVo);
return Result.success(page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public Result info(@PathVariable("id") Integer id) {
VideoTotalEntity videoTotal = videoTotalService.getById(id);
return Result.success(videoTotal);
}
/**
* 保存
*/
@CrossOrigin
@RequestMapping("/save")
public Result save(@RequestParam Integer userId,
@RequestParam String topic,
MultipartFile file) throws UnknownHostException {
VideoTotalEntity videoTotalEntity = new VideoTotalEntity();
videoTotalEntity.setTopic(topic);
videoTotalEntity.setUserId(userId);
videoTotalEntity.setPath(imagePath + file.getOriginalFilename());
videoTotalEntity.setCoverUrl("http://localhost:8000/file/imageFile/" + file.getOriginalFilename());
boolean save = videoTotalService.save(videoTotalEntity);
if (save) {
try {
FileUtil.uploadFile(file.getBytes(), imagePath, file.getOriginalFilename());
} catch (Exception e) {
e.printStackTrace();
}
return Result.successCode();
}
return Result.failureCode();
}
/**
* 修改
*/
@RequestMapping("/update")
public Result update(@RequestBody VideoTotalEntity videoTotal) {
boolean b = videoTotalService.updateById(videoTotal);
*/
@RequestMapping("/list")
public Result list(@RequestBody HomeworkVo homeworkVo) {
homeworkVo.setPage((homeworkVo.getPage() - 1) * homeworkVo.getPageSize());
Map<String, Object> page = homeworkService.queryPage(homeworkVo);
return Result.success(page);
}
/**
* 查询未做作业列表
*/
@RequestMapping("/findNotDoHomework")
public Result findNotDoHomework(@RequestBody HomeworkVo homeworkVo) {
homeworkVo.setPage((homeworkVo.getPage() - 1) * homeworkVo.getPageSize());
Map<String, Object> page = homeworkService.findNotDoHomework(homeworkVo);
return Result.success(page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public Result info(@PathVariable("id") Integer id) {
HomeworkEntity homework = homeworkService.getById(id);
return Result.success(homework);
}
/**
* 保存
*/
@RequestMapping("/save")
public Result save(@RequestBody HomeworkEntity homework) {
boolean save = homeworkService.save(homework);
if (save) {
return Result.successCode();
}
return Result.failureCode();
}
/**
/**
* 保存
*/
@RequestMapping("/save")
public Result save(@RequestBody AskQuestionsEntity askQuestions) {
boolean save = askQuestionsService.save(askQuestions);
if (save) {
return Result.successCode();
}
return Result.failureCode();
}
/**
* 修改
*/
@RequestMapping("/update")
public Result update(@RequestBody AskQuestionsVo askQuestionsVo) {
AskQuestionsEntity askQuestionsEntity = new AskQuestionsEntity();
askQuestionsEntity.setStatus(askQuestionsVo.getStatus());
askQuestionsEntity.setId(askQuestionsVo.getId());
askQuestionsEntity.setRestore(askQuestionsVo.getRestore());
boolean b = askQuestionsService.updateById(askQuestionsEntity);
if (b) {
return Result.successCode();
}
return Result.failureCode();
}
/**
* 删除
*/
@RequestMapping("/delete")
public Result delete(@RequestBody AskQuestionsEntity askQuestionsEntity) {
boolean remove = askQuestionsService.removeById(askQuestionsEntity.getId());
if (remove) {
return Result.successCode();
}
return Result.failureCode();
}
}
public Result save(@RequestBody AskQuestionsEntity askQuestions) {
boolean save = askQuestionsService.save(askQuestions);
if (save) {
return Result.successCode();
}
return Result.failureCode();
}
/**
* 修改
*/
@RequestMapping("/update")
public Result update(@RequestBody AskQuestionsVo askQuestionsVo) {
AskQuestionsEntity askQuestionsEntity = new AskQuestionsEntity();
askQuestionsEntity.setStatus(askQuestionsVo.getStatus());
askQuestionsEntity.setId(askQuestionsVo.getId());
askQuestionsEntity.setRestore(askQuestionsVo.getRestore());
boolean b = askQuestionsService.updateById(askQuestionsEntity);
if (b) {
return Result.successCode();
}
return Result.failureCode();
}
/**
* 删除
*/
@RequestMapping("/delete")
public Result delete(@RequestBody AskQuestionsEntity askQuestionsEntity) {
boolean remove = askQuestionsService.removeById(askQuestionsEntity.getId());
if (remove) {
return Result.successCode();
}
return Result.failureCode();
}
}
userEntity.setId(userVo.getId());
userEntity.setUserName(userVo.getUserName());
userEntity.setSex(userVo.getSex());
b = userService.updateById(userEntity);
} else {
b = userService.updateById(userVo.getUserEntity());
}
if (b) {
if (userVo.getClassId() != null) {
//根据老师ID删除老师所对应的班级并重新新增
QueryWrapper<UserClassEntity> userClassQueryWrapper = new QueryWrapper<>();
if (userVo.getUserEntity() != null) {
userClassQueryWrapper.eq("user_id", userVo.getUserEntity().getId());
} else {
userClassQueryWrapper.eq("user_id", userVo.getId());
}
userClassService.remove(userClassQueryWrapper);
UserClassEntity userClassEntity = new UserClassEntity();
userClassEntity.setClassId(userVo.getClassId());
if (userVo.getUserEntity() != null) {
userClassEntity.setUserId(userVo.getUserEntity().getId());
} else {
userClassEntity.setUserId(userVo.getId());
}
userClassService.save(userClassEntity);
}
if (userVo.getSubjectId() != null) {
//根据老师ID删除老师所对应的科目并重新新增
QueryWrapper<UserSubjectEntity> userSubjectQueryWrapper = new QueryWrapper<>();
userSubjectQueryWrapper.eq("user_id", userVo.getUserEntity().getId());
userSubjectService.remove(userSubjectQueryWrapper);
UserSubjectEntity userSubjectEntity = new UserSubjectEntity();
userSubjectEntity.setSubjectId(userVo.getSubjectId());
userSubjectEntity.setUserId(userVo.getUserEntity().getId());
userSubjectService.save(userSubjectEntity);
}
return Result.successCode();
}
return Result.failureCode();
}
/**
* 删除
/**
* @email ${email}
*/
@RestController
@RequestMapping("study/applicant")
public class ApplicantController {
@Autowired
private ApplicantService applicantService;
@Autowired
private UserClassService userClassService;
/**
* 列表
*/
@RequestMapping("/list")
public Result list(@RequestBody ApplicantVo applicantVo) {
applicantVo.setPage((applicantVo.getPage() - 1) * applicantVo.getPageSize());
Map<String, Object> page = applicantService.queryPage(applicantVo);
return Result.success(page);
}
/**
* 列表
*/
@RequestMapping("/joinTrueOrFalse")
public Result joinTrueOrFalse(@RequestBody ApplicantVo applicantVo) {
QueryWrapper<UserClassEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", applicantVo.getUserId());
List<UserClassEntity> list = userClassService.list(queryWrapper);
List<ApplicantEntity> list1 = applicantService.list(new QueryWrapper<ApplicantEntity>().
eq("user_id", applicantVo.getUserId())
.eq("status", 1));
return Result.success((list.size() + list1.size()) != 0);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public Result info(@PathVariable("id") Integer id) {
VideoTotalEntity videoTotal = videoTotalService.getById(id);
return Result.success(videoTotal);
}
/**
* 保存
*/
@CrossOrigin
@RequestMapping("/save")
public Result save(@RequestParam Integer userId,
@RequestParam String topic,
MultipartFile file) throws UnknownHostException {
VideoTotalEntity videoTotalEntity = new VideoTotalEntity();
videoTotalEntity.setTopic(topic);
videoTotalEntity.setUserId(userId);
videoTotalEntity.setPath(imagePath + file.getOriginalFilename());
videoTotalEntity.setCoverUrl("http://localhost:8000/file/imageFile/" + file.getOriginalFilename());
boolean save = videoTotalService.save(videoTotalEntity);
if (save) {
try {
FileUtil.uploadFile(file.getBytes(), imagePath, file.getOriginalFilename());
} catch (Exception e) {
e.printStackTrace();
}
return Result.successCode();
}
return Result.failureCode();
}
/**
* 修改
*/
@RequestMapping("/update")
public Result update(@RequestBody VideoTotalEntity videoTotal) {
boolean b = videoTotalService.updateById(videoTotal);
if (b) {
return Result.successCode();
}
return Result.failureCode();
}
/**
* 删除
*/
@RequestMapping("/delete")
public Result delete(@RequestBody VideoTotalVo videoTotalVo) {
VideoTotalEntity byId = videoTotalService.getById(videoTotalVo.getId());
@RequestMapping("/info/{id}")
public Result info(@PathVariable("id") Integer id){
ExercisesEntity exercises = exercisesService.getById(id);
return Result.success(exercises);
}
/**
* 保存
*/
@RequestMapping("/save")
public Result save(@RequestBody ExercisesEntity exercises){
boolean save = exercisesService.save(exercises);
if (save){
return Result.successCode();
}
return Result.failureCode();
}
/**
* 修改
*/
@RequestMapping("/update")
public Result update(@RequestBody ExercisesEntity exercises){
boolean b = exercisesService.updateById(exercises);
if (b){
return Result.successCode();
}
return Result.failureCode();
}
/**
* 删除
*/
@RequestMapping("/delete")
public Result delete(@RequestBody ExercisesEntity exercises){
boolean remove = exercisesService.removeById(exercises.getId());
if (remove){
return Result.successCode();
}
return Result.failureCode();
}
if (save){
return Result.successCode();
}
return Result.failureCode();
}
/**
* 修改
*/
@RequestMapping("/update")
public Result update(@RequestBody UserRoleEntity userRole) {
boolean b = userRoleService.updateById(userRole);
if (b){
return Result.successCode();
}
return Result.failureCode();
}
/**
* 删除
*/
@RequestMapping("/delete")
public Result delete(@RequestBody Integer[] ids) {
userRoleService.removeByIds(Arrays.asList(ids));
return Result.successCode();
}
}
/**
/**
* @email ${email}
*/
@RestController
@RequestMapping("study/videoTotal")
public class VideoTotalController {
@Value("${file.imagePath}")
private String imagePath;
@Autowired
private VideoTotalService videoTotalService;
@Autowired
private VideosService videosService;
/**
* 分页查询
*/
@RequestMapping("/list")
public Result list(@RequestBody VideoTotalVo videoTotalVo) {
videoTotalVo.setPage((videoTotalVo.getPage() - 1) * videoTotalVo.getPageSize());
Map<String, Object> page = videoTotalService.queryPage(videoTotalVo);
return Result.success(page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public Result info(@PathVariable("id") Integer id) {
if (save){
return Result.successCode();
}
return Result.failureCode();
}
/**
* 修改
*/
@RequestMapping("/update")
public Result update(@RequestBody KnowledgePointVo knowledgePointVo) {
KnowledgePointEntity knowledgePointEntity = new KnowledgePointEntity();
knowledgePointEntity.setId(knowledgePointVo.getId());
knowledgePointEntity.setClassId(knowledgePointVo.getClassId());
knowledgePointEntity.setTitle(knowledgePointVo.getTitle());
knowledgePointEntity.setContent(knowledgePointVo.getContent());
boolean b = knowledgePointService.updateById(knowledgePointEntity);
if (b){
return Result.successCode();
}
return Result.failureCode();
}
/**
* 删除
*/
@RequestMapping("/delete")
public Result delete(@RequestBody KnowledgePointEntity knowledgePoint) {
boolean remove = knowledgePointService.removeById(knowledgePoint.getId());
if (remove){
return Result.successCode();
}
return Result.failureCode();
}
}
knowledgePointEntity.setClassId(knowledgePointVo.getClassId());
knowledgePointEntity.setTitle(knowledgePointVo.getTitle());
knowledgePointEntity.setContent(knowledgePointVo.getContent());
boolean b = knowledgePointService.updateById(knowledgePointEntity);
if (b){
return Result.successCode();
}
return Result.failureCode();
}
/**
* 删除
*/
@RequestMapping("/delete")
public Result delete(@RequestBody KnowledgePointEntity knowledgePoint) {
boolean remove = knowledgePointService.removeById(knowledgePoint.getId());
if (remove){
return Result.successCode();
}
return Result.failureCode();
}
}
return Result.success(page);
}
/**
* 列表
*/
@RequestMapping("/joinTrueOrFalse")
public Result joinTrueOrFalse(@RequestBody ApplicantVo applicantVo) {
QueryWrapper<UserClassEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", applicantVo.getUserId());
List<UserClassEntity> list = userClassService.list(queryWrapper);
List<ApplicantEntity> list1 = applicantService.list(new QueryWrapper<ApplicantEntity>().
eq("user_id", applicantVo.getUserId())
.eq("status", 1));
return Result.success((list.size() + list1.size()) != 0);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public Result info(@PathVariable("id") Integer id) {
ApplicantEntity applicant = applicantService.getById(id);
return Result.success(applicant);
}
/**
* 保存
*/
@RequestMapping("/save")
public Result save(@RequestBody ApplicantEntity applicant) {
boolean save = applicantService.save(applicant);
if (save) {
return Result.successCode();
}
return Result.failureCode();
}
/**
* 修改
*/
}
return Result.failureCode();
}
/**
* 删除
*/
@RequestMapping("/delete")
public Result delete(@RequestBody ClassEntity classEntity) {
classService.removeById(classEntity.getId());
//删除对应班级的所有人员
QueryWrapper<UserClassEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("class_id",classEntity.getId());
userClassService.remove(queryWrapper);
return Result.successCode();
}
}
/**
* @email ${email}
*/
@RestController
@RequestMapping("study/knowledgePoint")
public class KnowledgePointController {
@Autowired
private KnowledgePointService knowledgePointService;
@RequestMapping("/findPage")
public Result findPage(@RequestBody SubjectVo subjectVo){
subjectVo.setPage((subjectVo.getPage() - 1) * subjectVo.getPageSize());
Map<String, Object> page = subjectService.findPage(subjectVo);
return Result.success(page);
}
/**
* 列表
*/
@RequestMapping("/queryList")
public Result queryList(@RequestBody SubjectVo SubjectVo) {
List<HashMap> page = subjectService.queryList(SubjectVo);
return Result.success(page);
}
/**
* 列表
*/
@GetMapping("/findList")
public Result findList() {
List<SubjectEntity> list = subjectService.list();
return Result.success(list);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public Result info(@PathVariable("id") Integer id){
SubjectEntity subject = subjectService.getById(id);
return Result.success(subject);
}
/**
* 保存
*/
@RequestMapping("/save")
public Result save(@RequestBody SubjectEntity subject){
boolean save = subjectService.save(subject);
}
/**
* 保存
*/
@RequestMapping("/save")
public Result save(@RequestBody UserSubjectEntity userSubject){
boolean save = userSubjectService.save(userSubject);
if (save) {
return Result.successCode();
}
return Result.failureCode();
}
/**
* 修改
*/
@RequestMapping("/update")
public Result update(@RequestBody UserSubjectEntity userSubject){
boolean update = userSubjectService.updateById(userSubject);
if (update) {
return Result.successCode();
}
return Result.failureCode();
}
/**
* 删除
*/
@RequestMapping("/delete")
public Result delete(@RequestBody Integer[] ids){
boolean b = userSubjectService.removeByIds(Arrays.asList(ids));
if (b) {
return Result.successCode();
}
return Result.failureCode();
}
}