Bootstrap

基于javaweb+mysql的springboot在线学习系统在线学习平台(学生、教师、管理员)(java+springboot+maven+vue+elementui+mysql)

基于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


}

/**
 * @email ${email}
 */
@RestController
@RequestMapping("study/videos")
public class VideosController {

    @Value("${file.videoPath}")
    private String videoPath;

    @Autowired
    private VideosService videosService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestBody VideosVo videosVo) {
        videosVo.setPage((videosVo.getPage() - 1) * videosVo.getPageSize());
    /**
     * 修改
     */
    @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();
    }

}

    private UserDoHomeworkService userDoHomeworkService;

    @Autowired
    private HomeworkService homeworkService;

    /**
     * 列表
     */
    @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("/info/{id}")
    public Result info(@PathVariable("id") Integer id) {
        UserClassEntity userClass = userClassService.getById(id);

        return Result.success(userClass);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Result save(@RequestBody UserClassEntity userClass) {
        boolean save = userClassService.save(userClass);
        if (save){
            return Result.successCode();
        }
        return Result.failureCode();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody UserClassEntity userClass) {
        boolean b = userClassService.updateById(userClass);
        if (b){
            return Result.successCode();
        }
        return Result.failureCode();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Result delete(@RequestBody UserClassEntity userClass) {
        QueryWrapper<UserClassEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("user_id",userClass.getUserId());
        boolean remove = userClassService.remove(queryWrapper);
        if (remove){
            return Result.successCode();
        }
        return Result.failureCode();
    }

}


/**
 * @email ${email}
 */
@RestController
@RequestMapping("study/userdohomework")
public class UserDoHomeworkController {
    @Autowired
    private UserDoHomeworkService userDoHomeworkService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestBody  UserDoHomeworkVo userDoHomeworkVo) {
        userDoHomeworkVo.setPage((userDoHomeworkVo.getPage() - 1) * userDoHomeworkVo.getPageSize());
        Map<String, Object> page = userDoHomeworkService.queryPage(userDoHomeworkVo);
        return Result.success(page);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public Result info(@PathVariable("id") Integer id) {
        UserDoHomeworkEntity userDoHomework = userDoHomeworkService.getById(id);

        return Result.success(userDoHomework);
    }

    /**
     * 保存
     */
        if (save){
            return Result.successCode();
        }
        return Result.failureCode();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody UserDoHomeworkEntity userDoHomework) {
        boolean b = userDoHomeworkService.updateById(userDoHomework);
        if (b){
            return Result.successCode();
        }
        return Result.failureCode();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Result delete(@RequestBody Integer[] ids) {
        userDoHomeworkService.removeByIds(Arrays.asList(ids));

        return Result.successCode();
    }

}


    /**
     * 信息
     */
    @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();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody ApplicantVo applicantVo) {
        ApplicantEntity applicantEntity = new ApplicantEntity();
        applicantEntity.setStatus(applicantVo.getStatus());
        applicantEntity.setId(applicantVo.getId());
        boolean b = applicantService.updateById(applicantEntity);
        if (b) {
            if (applicantVo.getStatus() == 2) {
                QueryWrapper<UserClassEntity> queryWrapper = new QueryWrapper<>();
                queryWrapper.eq("user_id", applicantVo.getUserId());
                List<UserClassEntity> list = userClassService.list(queryWrapper);
                if (list.size() > 0) {
                    return Result.failure("该学生已经加入了班级");
                }
                UserClassEntity userClassEntity = new UserClassEntity();
                userClassEntity.setClassId(applicantVo.getClassId());
                userClassEntity.setUserId(applicantVo.getUserId());
                userClassService.save(userClassEntity);
            }
            return Result.successCode();
    /**
     * 列表
     */
    @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);
        if (save) {
            return Result.successCode();
        }
        return Result.failureCode();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody SubjectEntity subject){
        boolean update = subjectService.updateById(subject);
        if (update) {
            return Result.successCode();
        }
        return Result.failureCode();
    }

    /**
    }

}

/**
 * @email ${email}
 */
@RestController
@RequestMapping("study/class")
public class ClassController {
    @Autowired
    private ClassService classService;

    @Autowired
    private UserClassService userClassService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestBody ClassVo classVo) {
        classVo.setPage((classVo.getPage() - 1) * classVo.getPageSize());
        Map<String, Object> page = classService.queryPage(classVo);
        return Result.success(page);
    }
            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());
        boolean b1 = FileUtil.deleteFile(byId.getPath());

        boolean remove = videoTotalService.removeById(videoTotalVo.getId());
        if (remove) {
            QueryWrapper<VideosEntity> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("video_total_id", videoTotalVo.getId());
            List<VideosEntity> list = videosService.list(queryWrapper);
            for (VideosEntity videosEntity : list) {
                boolean b = FileUtil.deleteFile(videosEntity.getPath());
                if (b) {
                    videosService.remove(queryWrapper);
                }
            }
        }
        return Result.successCode();
    }

}


/**
 * @email ${email}
 */
@RestController
@RequestMapping("study/videos")
public class VideosController {

    @Value("${file.videoPath}")
    private String videoPath;

    @Autowired
    private VideosService videosService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestBody VideosVo videosVo) {
        videosVo.setPage((videosVo.getPage() - 1) * videosVo.getPageSize());
        Map<String, Object> page = videosService.queryPage(videosVo);
        return Result.success(page);
    }

    /**
     * 列表
     */
    @RequestMapping("/selectByVideoTotalId")
    public Result selectByVideoTotalId(@RequestBody VideosVo videosVo) {
        QueryWrapper<VideosEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("video_total_id", videosVo.getVideoTotalId());
        queryWrapper.orderByAsc("sort");
        List<VideosEntity> list = videosService.list(queryWrapper);
        return Result.success(list);

/**
 * @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) {
        VideoTotalEntity videoTotal = videoTotalService.getById(id);
        return Result.success(videoTotal);
    }

    /**
     * 保存
     */
    @CrossOrigin
    @RequestMapping("/save")
        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}
     * 删除
     */
    @RequestMapping("/delete")
    public Result delete(@RequestBody Integer[] ids){
        boolean b = userSubjectService.removeByIds(Arrays.asList(ids));
        if (b) {
            return Result.successCode();
        }
        return Result.failureCode();
    }

}

/**
 * @email ${email}
 */
@RestController
@RequestMapping("study/userrole")
public class UserRoleController {
    @Autowired
    private UserRoleService userRoleService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public Result list(@RequestBody  UserRoleVo userRoleVo) {
        userRoleVo.setPage((userRoleVo.getPage() - 1) * userRoleVo.getPageSize());
    @RequestMapping("/selectByVideoTotalId")
    public Result selectByVideoTotalId(@RequestBody VideosVo videosVo) {
        QueryWrapper<VideosEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("video_total_id", videosVo.getVideoTotalId());
        queryWrapper.orderByAsc("sort");
        List<VideosEntity> list = videosService.list(queryWrapper);
        return Result.success(list);
    }

    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public Result info(@PathVariable("id") Integer id) {
        VideosEntity videos = videosService.getById(id);

        return Result.success(videos);
    }

    /**
     * 保存
     */
    @CrossOrigin
    @RequestMapping("/save")
    public Result save(@RequestParam Integer sort,
                       @RequestParam String topic,
                       @RequestParam Integer videoTotalId,
                       MultipartFile file) throws UnknownHostException {
        VideosEntity videos = new VideosEntity();
        videos.setSort(sort);
        videos.setTopic(topic);
        videos.setVideoTotalId(videoTotalId);
        videos.setVideoUrl("http://localhost:8000/file/videoFile/" + file.getOriginalFilename());
        videos.setPath(videoPath + file.getOriginalFilename());
        boolean save = videosService.save(videos);
        if (save) {
            try {
                FileUtil.uploadFile(file.getBytes(), videoPath, file.getOriginalFilename());
            } catch (Exception e) {
                e.printStackTrace();
            }
            return Result.successCode();
        }
        return Result.failureCode();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody VideosEntity videos) {
        boolean b = videosService.updateById(videos);

/**
 * @email ${email}
 */
@RestController
@RequestMapping("study/homework")
public class HomeworkController {

    @Autowired
    private UserClassService userClassService;

    @Autowired
    private UserDoHomeworkService userDoHomeworkService;

    @Autowired
    private HomeworkService homeworkService;

    /**
     * 列表
     */
    @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);
    }
/**
 * @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();
        }
    public Result info(@PathVariable("id") Integer id) {
        UserDoHomeworkEntity userDoHomework = userDoHomeworkService.getById(id);

        return Result.success(userDoHomework);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public Result save(@RequestBody UserDoHomeworkVo userDoHomeworkVo) {
        UserDoHomeworkEntity userDoHomeworkEntity = new UserDoHomeworkEntity();
        userDoHomeworkEntity.setHomeworkId(userDoHomeworkVo.getHomeworkId());
        userDoHomeworkEntity.setReply(userDoHomeworkVo.getContent());
        userDoHomeworkEntity.setUserId(userDoHomeworkVo.getUserId());
        boolean save = userDoHomeworkService.save(userDoHomeworkEntity);
        if (save){
            return Result.successCode();
        }
        return Result.failureCode();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public Result update(@RequestBody UserDoHomeworkEntity userDoHomework) {
        boolean b = userDoHomeworkService.updateById(userDoHomework);
        if (b){
            return Result.successCode();
        }
        return Result.failureCode();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public Result delete(@RequestBody Integer[] ids) {
        userDoHomeworkService.removeByIds(Arrays.asList(ids));

        return Result.successCode();
    }

}

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

;