Online Classroom|Online learning platform based on Springboot+Vue

Author Home Page: Programming Compass

About the author: High-quality creator in the Java field, CSDN blog expert, CSDN content partner, Nuggets guest author, Alibaba Cloud blog expert, 51CTO guest author, many years of architect design experience, Tencent classroom resident lecturer

Main contents: Java projects, Python projects, front-end projects, artificial intelligence and big data, resume templates, study materials, interview question bank, technical mutual assistance

Collect, like and don’t get lost. It’s good to follow the author.

Get the source code at the end of the article 

Project number: BS-GX-068

1. Introduction to the environment

Locale: Java: jdk1.8

Database: Mysql: mysql5.7

Application server: Tomcat: tomcat8.5.31

Development tools: IDEA or eclipse

Development technology: Springboot+Vue

2. Project Introduction

This project develops and implements an online course learning platform for college students based on Springboot+Vue. There are three categories of platform users: students, teachers, and administrators. After registering and logging in, students can view relevant classes, play course videos online for learning, purchase courses, complete course transactions, evaluate courses, add learning records for recording, and leave online consultation messages, etc. Teacher accounts are assigned by administrators. After logging in, you can add courses, add learning videos corresponding to the courses, query course evaluations and reply, view students' learning records, reply to student consultation information, etc. The administrator mainly manages all information on the platform, including student management, teacher management, course management, classification management, video management, consultation management, learning record management, carousel management, friendly link management, etc., and includes courses Sales graphic report statistics are implemented using Echart. See the function implementation demonstration below for details.

3. System display

System homepage

student registration

User login

Course purchase and collection

Course evaluation

Online Learning

Online consultation

personal center

Teacher login system

Course information management

Add course video

Course purchase record

Course study inquiry

Personal Data Modification

Administrator login

Course information management

Course purchase statistics

System Management

4. Core code display

package com.spring.controller;

import com.jntoo.db.*;
import com.jntoo.db.utils.*;
import com.spring.dao.*;
import com.spring.entity.*;
import com.spring.service.*;
import com.spring.util.*;
import com.spring.util.Info;
import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import tk.mybatis.mapper.entity.Example;

/**
 * 教师 */
@Controller
public class JiaoshiController extends BaseController {

    @Autowired
    private JiaoshiMapper dao;

    @Autowired
    private JiaoshiService service;

    /**
     *  后台列表页
     *
     */
    @RequestMapping("/jiaoshi_list")
    public String list() {
        // 检测是否有登录,没登录则跳转到登录页面
        if (!checkLogin()) {
            return showError("尚未登录", "./login.do");
        }

        String order = Request.get("order", "id"); // 获取前台提交的URL参数 order  如果没有则设置为id
        String sort = Request.get("sort", "desc"); // 获取前台提交的URL参数 sort  如果没有则设置为desc
        int pagesize = Request.getInt("pagesize", 12); // 获取前台一页多少行数据
        Example example = new Example(Jiaoshi.class); //  创建一个扩展搜索类
        Example.Criteria criteria = example.createCriteria(); // 创建一个扩展搜索条件类
        String where = " 1=1 "; // 创建初始条件为:1=1
        where += getWhere(); // 从方法中获取url 上的参数,并写成 sql条件语句
        criteria.andCondition(where); // 将条件写进上面的扩展条件类中
        if (sort.equals("desc")) { // 判断前台提交的sort 参数是否等于  desc倒序  是则使用倒序,否则使用正序
            example.orderBy(order).desc(); // 把sql 语句设置成倒序
        } else {
            example.orderBy(order).asc(); // 把 sql 设置成正序
        }
        int page = request.getParameter("page") == null ? 1 : Integer.valueOf(request.getParameter("page")); // 获取前台提交的URL参数 page  如果没有则设置为1
        page = Math.max(1, page); // 取两个数的最大值,防止page 小于1
        List<Jiaoshi> list = service.selectPageExample(example, page, pagesize); // 获取当前页的行数

        // 将列表写给界面使用
        assign("totalCount", request.getAttribute("totalCount"));
        assign("list", list);
        assign("orderby", order); // 把当前排序结果写进前台
        assign("sort", sort); // 把当前排序结果写进前台
        return json(); // 将数据写给前端
    }

    public String getWhere() {
        _var = new LinkedHashMap(); // 重置数据
        String where = " ";
        // 以下也是一样的操作,判断是否符合条件,符合则写入sql 语句
        if (!Request.get("gonghao").equals("")) {
            where += " AND gonghao LIKE '%" + Request.get("gonghao") + "%' ";
        }
        return where;
    }

    @RequestMapping("/jiaoshi_add")
    public String add() {
        _var = new LinkedHashMap(); // 重置数据

        return json(); // 将数据写给前端
    }

    @RequestMapping("/jiaoshi_updt")
    public String updt() {
        _var = new LinkedHashMap(); // 重置数据
        int id = Request.getInt("id");
        // 获取行数据,并赋值给前台jsp页面
        Jiaoshi mmm = service.find(id);
        assign("mmm", mmm);
        assign("updtself", 0);

        return json(); // 将数据写给前端
    }

    @RequestMapping("/jiaoshi_updtself")
    public String updtself() {
        _var = new LinkedHashMap(); // 重置数据
        // 更新个人资料
        int id = (int) request.getSession().getAttribute("id");
        Jiaoshi mmm = service.find(id);
        assign("mmm", mmm);
        assign("updtself", 1);
        return json(); // 将数据写给前端
    }

    /**
     * 添加内容
     * @return
     */
    @RequestMapping("/jiaoshiinsert")
    public String insert() {
        _var = new LinkedHashMap(); // 重置数据
        String tmp = "";
        Jiaoshi post = new Jiaoshi(); // 创建实体类
        // 设置前台提交上来的数据到实体类中
        post.setGonghao(Request.get("gonghao"));

        post.setMima(Request.get("mima"));

        post.setXingming(Request.get("xingming"));

        post.setXingbie(Request.get("xingbie"));

        post.setLianxidianhua(Request.get("lianxidianhua"));

        post.setYouxiang(Request.get("youxiang"));

        post.setTouxiang(Request.get("touxiang"));

        service.insert(post); // 插入数据
        int charuid = post.getId().intValue();

        if (isAjax()) {
            return jsonResult(post);
        }
        return showSuccess("保存成功", Request.get("referer").equals("") ? request.getHeader("referer") : Request.get("referer"));
    }

    /**
     * 更新内容
     * @return
     */
    @RequestMapping("/jiaoshiupdate")
    public String update() {
        _var = new LinkedHashMap(); // 重置数据
        // 创建实体类
        Jiaoshi post = new Jiaoshi();
        // 将前台表单数据填充到实体类
        if (!Request.get("gonghao").equals("")) post.setGonghao(Request.get("gonghao"));
        if (!Request.get("mima").equals("")) post.setMima(Request.get("mima"));
        if (!Request.get("xingming").equals("")) post.setXingming(Request.get("xingming"));
        if (!Request.get("xingbie").equals("")) post.setXingbie(Request.get("xingbie"));
        if (!Request.get("lianxidianhua").equals("")) post.setLianxidianhua(Request.get("lianxidianhua"));
        if (!Request.get("youxiang").equals("")) post.setYouxiang(Request.get("youxiang"));
        if (!Request.get("touxiang").equals("")) post.setTouxiang(Request.get("touxiang"));

        post.setId(Request.getInt("id"));
        service.update(post); // 更新数据
        int charuid = post.getId().intValue();

        if (isAjax()) {
            return jsonResult(post);
        }
        if (Request.getInt("updtself") == 1) {
            return showSuccess("保存成功", "jiaoshi_updtself.do");
        }

        return showSuccess("保存成功", Request.get("referer")); // 弹出保存成功,并跳转到前台提交的 referer 页面
    }

    /**
     *  后台详情
     */
    @RequestMapping("/jiaoshi_detail")
    public String detail() {
        _var = new LinkedHashMap(); // 重置数据
        int id = Request.getInt("id");
        Jiaoshi map = service.find(id); // 根据前台url 参数中的id获取行数据
        assign("map", map); // 把数据写到前台
        return json(); // 将数据写给前端
    }

    /**
     *  删除
     */
    @RequestMapping("/jiaoshi_delete")
    public String delete() {
        _var = new LinkedHashMap(); // 重置数据
        if (!checkLogin()) {
            return showError("尚未登录");
        }
        int id = Request.getInt("id"); // 根据id 删除某行数据
        Map map = Query.make("jiaoshi").find(id);

        service.delete(id); // 根据id 删除某行数据
        return showSuccess("删除成功", request.getHeader("referer")); //弹出删除成功,并跳回上一页
    }
}
package com.spring.controller;

import com.jntoo.db.*;
import com.jntoo.db.utils.*;
import com.spring.dao.*;
import com.spring.entity.*;
import com.spring.service.*;
import com.spring.util.*;
import com.spring.util.Info;
import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import tk.mybatis.mapper.entity.Example;

/**
 * 留言板 */
@Controller
public class LiuyanbanController extends BaseController {

    @Autowired
    private LiuyanbanMapper dao;

    @Autowired
    private LiuyanbanService service;

    /**
     *  后台列表页
     *
     */
    @RequestMapping("/liuyanban_list")
    public String list() {
        // 检测是否有登录,没登录则跳转到登录页面
        if (!checkLogin()) {
            return showError("尚未登录", "./login.do");
        }

        String order = Request.get("order", "id"); // 获取前台提交的URL参数 order  如果没有则设置为id
        String sort = Request.get("sort", "desc"); // 获取前台提交的URL参数 sort  如果没有则设置为desc
        int pagesize = Request.getInt("pagesize", 12); // 获取前台一页多少行数据
        Example example = new Example(Liuyanban.class); //  创建一个扩展搜索类
        Example.Criteria criteria = example.createCriteria(); // 创建一个扩展搜索条件类
        String where = " 1=1 "; // 创建初始条件为:1=1
        where += getWhere(); // 从方法中获取url 上的参数,并写成 sql条件语句
        criteria.andCondition(where); // 将条件写进上面的扩展条件类中
        if (sort.equals("desc")) { // 判断前台提交的sort 参数是否等于  desc倒序  是则使用倒序,否则使用正序
            example.orderBy(order).desc(); // 把sql 语句设置成倒序
        } else {
            example.orderBy(order).asc(); // 把 sql 设置成正序
        }
        int page = request.getParameter("page") == null ? 1 : Integer.valueOf(request.getParameter("page")); // 获取前台提交的URL参数 page  如果没有则设置为1
        page = Math.max(1, page); // 取两个数的最大值,防止page 小于1
        List<Liuyanban> list = service.selectPageExample(example, page, pagesize); // 获取当前页的行数

        // 将列表写给界面使用
        assign("totalCount", request.getAttribute("totalCount"));
        assign("list", list);
        assign("orderby", order); // 把当前排序结果写进前台
        assign("sort", sort); // 把当前排序结果写进前台
        return json(); // 将数据写给前端
    }

    public String getWhere() {
        _var = new LinkedHashMap(); // 重置数据
        String where = " ";
        // 以下也是一样的操作,判断是否符合条件,符合则写入sql 语句
        return where;
    }

    /**
     * 留言人列表
     */
    @RequestMapping("/liuyanban_list_liuyanren")
    public String listliuyanren() {
        // 检测是否有登录,没登录则跳转到登录页面
        if (!checkLogin()) {
            return showError("尚未登录", "./login.do");
        }
        String order = Request.get("order", "id"); // 获取前台提交的URL参数 order  如果没有则设置为id
        String sort = Request.get("sort", "desc"); // 获取前台提交的URL参数 sort  如果没有则设置为desc
        int pagesize = Request.getInt("pagesize", 12); // 获取前台一页多少行数据

        Example example = new Example(Liuyanban.class); //  创建一个扩展搜索类
        Example.Criteria criteria = example.createCriteria(); // 创建一个扩展搜索条件类
        // 初始化一个条件,条件为:留言人=当前登录用户
        String where = " liuyanren='" + request.getSession().getAttribute("username") + "' ";
        where += getWhere();

        criteria.andCondition(where); // 将条件写入
        if (sort.equals("desc")) { // 注释同list
            example.orderBy(order).desc(); // 注释同list
        } else {
            example.orderBy(order).asc(); // 注释同list
        }

        int page = request.getParameter("page") == null ? 1 : Integer.valueOf(request.getParameter("page")); // 注释同list
        page = Math.max(1, page); // 注释同list

        List<Liuyanban> list = service.selectPageExample(example, page, pagesize);
        assign("totalCount", request.getAttribute("totalCount"));
        assign("list", list);
        assign("orderby", order);
        assign("sort", sort);
        return json(); // 将数据写给前端
    }

    @RequestMapping("/liuyanban_add")
    public String add() {
        _var = new LinkedHashMap(); // 重置数据

        return json(); // 将数据写给前端
    }

    @RequestMapping("/liuyanban_updt")
    public String updt() {
        _var = new LinkedHashMap(); // 重置数据
        int id = Request.getInt("id");
        // 获取行数据,并赋值给前台jsp页面
        Liuyanban mmm = service.find(id);
        assign("mmm", mmm);
        assign("updtself", 0);

        return json(); // 将数据写给前端
    }

    /**
     * 添加内容
     * @return
     */
    @RequestMapping("/liuyanbaninsert")
    public String insert() {
        _var = new LinkedHashMap(); // 重置数据
        String tmp = "";
        Liuyanban post = new Liuyanban(); // 创建实体类
        // 设置前台提交上来的数据到实体类中
        post.setXingming(Request.get("xingming"));

        post.setLianxidianhua(Request.get("lianxidianhua"));

        post.setLiuyanneirong(Request.get("liuyanneirong"));

        post.setLiuyanren(Request.get("liuyanren"));

        post.setZhuangtai(Request.get("zhuangtai"));

        post.setHuifuneirong(Request.get("huifuneirong"));

        service.insert(post); // 插入数据
        int charuid = post.getId().intValue();

        if (isAjax()) {
            return jsonResult(post);
        }
        return showSuccess("保存成功", Request.get("referer").equals("") ? request.getHeader("referer") : Request.get("referer"));
    }

    /**
     * 更新内容
     * @return
     */
    @RequestMapping("/liuyanbanupdate")
    public String update() {
        _var = new LinkedHashMap(); // 重置数据
        // 创建实体类
        Liuyanban post = new Liuyanban();
        // 将前台表单数据填充到实体类
        if (!Request.get("xingming").equals("")) post.setXingming(Request.get("xingming"));
        if (!Request.get("lianxidianhua").equals("")) post.setLianxidianhua(Request.get("lianxidianhua"));
        if (!Request.get("liuyanneirong").equals("")) post.setLiuyanneirong(Request.get("liuyanneirong"));
        if (!Request.get("liuyanren").equals("")) post.setLiuyanren(Request.get("liuyanren"));
        if (!Request.get("zhuangtai").equals("")) post.setZhuangtai(Request.get("zhuangtai"));
        if (!Request.get("huifuneirong").equals("")) post.setHuifuneirong(Request.get("huifuneirong"));

        post.setId(Request.getInt("id"));
        service.update(post); // 更新数据
        int charuid = post.getId().intValue();
        Query.execute("update liuyanban set zhuangtai='已回复' where id='" + charuid + "'");

        if (isAjax()) {
            return jsonResult(post);
        }

        return showSuccess("保存成功", Request.get("referer")); // 弹出保存成功,并跳转到前台提交的 referer 页面
    }

    /**
     *  删除
     */
    @RequestMapping("/liuyanban_delete")
    public String delete() {
        _var = new LinkedHashMap(); // 重置数据
        if (!checkLogin()) {
            return showError("尚未登录");
        }
        int id = Request.getInt("id"); // 根据id 删除某行数据
        Map map = Query.make("liuyanban").find(id);

        service.delete(id); // 根据id 删除某行数据
        return showSuccess("删除成功", request.getHeader("referer")); //弹出删除成功,并跳回上一页
    }
}

5. Display of related works

Practical projects based on Java development, Python development, PHP development, C# development and other related languages

Front-end practical projects developed based on Nodejs, Vue and other front-end technologies

Related works based on WeChat applet and Android APP application development

Development and application of embedded Internet of Things based on 51 microcontroller and other embedded devices

AI intelligent applications based on various algorithms

Various data management and recommendation systems based on big data

 

 

Guess you like

Origin blog.csdn.net/whirlwind526/article/details/132800125