基于ssm在线教育系统平台源码和论文

在线教育学习系统的开发与设计

【538】基于ssm在线教育系统平台源码和论文

摘要: 随着计算机技术和多媒体技术的不断发展与成熟,越来越多的学习者选择网络平台这一既先进又普遍的学习方式。互联网具有双向交换这一特点,信息交互非常便利,因此使用网络平台这种学习方式和线下实际学习上课相比有着独特的优势,更适合学习者进行更方便的自主学习。在线教育学习系统开发目的是使学校的教学模式模式从线下时时教学方式转变成线上随时管理,为教师和学生提供方便条件。在经过学校提供的数据进行实际调研分析后,了解学校各方面需求情况,对学校已有的教育教学管理模式进行修改完善,在这个基础上修改出—套符合学校需求的网课系统,借此机会熟悉系统开发的流程。随着后期工作对信息管理系统的功能进行不断调整和完善,学校方面的信息管理将越来越依赖于通过系统来处理。所以系统开发也要根据学校教学工作的实际情况来进行调整,使其更加符合学校教师及学生的需求。

本系统所使用的数据库为Mysql,在此基础上使用JSP技术开发,以Tomcat服务器配置运行环境,并使用IDEA作为开发平台。在设计时,尽量保证系统代码的整洁性、实用性、可读性、通用性、便于后期进行维护。

关键词:在线教育,网络教学平台,Mysql,信息管理系统,数据库,管理系统

Development and design of micro lesson learning system in primary and secondary schools

                       

Abstract:With the continuous development and maturity of computer technology and multimedia technology, more and more learners choose the network platform, which is an advanced and common way of learning. The Internet has the characteristics of two-way exchange, and information exchange is very convenient. Therefore, compared with offline learning, using the network platform has unique advantages, which is more suitable for learners to carry out more convenient autonomous learning. The purpose of the development of micro lesson learning system in primary and secondary schools is to change the teaching mode from offline teaching mode to online management mode, so as to provide convenient conditions for teachers and students. After the actual investigation and analysis of the data provided by the school, understand the needs of all aspects of the school, modify and improve the existing education and teaching management mode of the school, on this basis, modify a set of online course system that meets the needs of the school, and take this opportunity to be familiar with the development process of the system. With the continuous adjustment and improvement of the function of the information management system in the later work, the information management of the school will more and more rely on the system to deal with. Therefore, the system development should be adjusted according to the actual situation of school teaching, so as to make it more in line with the needs of school teachers and students.

The database used in this system is mysql. On this basis, JSP technology is used to develop. Tomcat server is used to configure the running environment, and IDEA is used as the development platform. In the design, try to ensure that the system code is clean, practical, readable, universal, easy to maintain later.

Keywords: Micro class, network teaching platform, mysql, information management system, database, management system

package com.controller;


import java.text.SimpleDateFormat;
import com.alibaba.fastjson.JSONObject;
import java.util.*;
import org.springframework.beans.BeanUtils;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.context.ContextLoader;
import javax.servlet.ServletContext;
import com.service.TokenService;
import com.utils.StringUtil;
import java.lang.reflect.InvocationTargetException;

import com.service.DictionaryService;
import org.apache.commons.lang3.StringUtils;
import com.annotation.IgnoreAuth;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;

import com.entity.JiaoshiEntity;

import com.service.JiaoshiService;
import com.entity.view.JiaoshiView;

import com.utils.PageUtils;
import com.utils.R;

/**
 * 教师
 * 后端接口
 * @author
 * @email
 * @date 2023-04-15
*/
@RestController
@Controller
@RequestMapping("/jiaoshi")
public class JiaoshiController {
    private static final Logger logger = LoggerFactory.getLogger(JiaoshiController.class);

    @Autowired
    private JiaoshiService jiaoshiService;


    @Autowired
    private TokenService tokenService;
    @Autowired
    private DictionaryService dictionaryService;



    //级联表service


    /**
    * 后端列表
    */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isNotEmpty(role) && "学生".equals(role)){
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        } if(StringUtil.isNotEmpty(role) && "教师".equals(role)){
            params.put("jiaoshiId",request.getSession().getAttribute("userId"));
        }
        params.put("orderBy","id");
        PageUtils page = jiaoshiService.queryPage(params);

        //字典表数据转换
        List<JiaoshiView> list =(List<JiaoshiView>)page.getList();
        for(JiaoshiView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c);
        }
        return R.ok().put("data", page);
    }

    /**
    * 后端详情
    */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") Long id){
        logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        JiaoshiEntity jiaoshi = jiaoshiService.selectById(id);
        if(jiaoshi !=null){
            //entity转view
            JiaoshiView view = new JiaoshiView();
            BeanUtils.copyProperties( jiaoshi , view );//把实体数据重构到view中

            //修改对应字典表字段
            dictionaryService.dictionaryConvert(view);
            return R.ok().put("data", view);
        }else {
            return R.error(511,"查不到数据");
        }

    }

    /**
    * 后端保存
    */
    @RequestMapping("/save")
    public R save(@RequestBody JiaoshiEntity jiaoshi, HttpServletRequest request){
        logger.debug("save方法:,,Controller:{},,jiaoshi:{}",this.getClass().getName(),jiaoshi.toString());
        Wrapper<JiaoshiEntity> queryWrapper = new EntityWrapper<JiaoshiEntity>()
            .eq("username", jiaoshi.getUsername())
            .eq("password", jiaoshi.getPassword())
            .eq("jiaoshi_name", jiaoshi.getJiaoshiName())
            .eq("sex_types", jiaoshi.getSexTypes())
            .eq("jiaoshi_id_number", jiaoshi.getJiaoshiIdNumber())
            .eq("jiaoshi_phone", jiaoshi.getJiaoshiPhone())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        JiaoshiEntity jiaoshiEntity = jiaoshiService.selectOne(queryWrapper);
        if(jiaoshiEntity==null){
            jiaoshi.setCreateTime(new Date());
            jiaoshi.setPassword("123456");
        //  String role = String.valueOf(request.getSession().getAttribute("role"));
        //  if("".equals(role)){
        //      jiaoshi.set
        //  }
            jiaoshiService.insert(jiaoshi);
            return R.ok();
        }else {
            return R.error(511,"账户或者身份证号或者手机号已经被使用");
        }
    }

    /**
    * 后端修改
    */
    @RequestMapping("/update")
    public R update(@RequestBody JiaoshiEntity jiaoshi, HttpServletRequest request){
        logger.debug("update方法:,,Controller:{},,jiaoshi:{}",this.getClass().getName(),jiaoshi.toString());
        //根据字段查询是否有相同数据
        Wrapper<JiaoshiEntity> queryWrapper = new EntityWrapper<JiaoshiEntity>()
            .notIn("id",jiaoshi.getId())
            .andNew()
            .eq("username", jiaoshi.getUsername())
            .eq("password", jiaoshi.getPassword())
            .eq("jiaoshi_name", jiaoshi.getJiaoshiName())
            .eq("sex_types", jiaoshi.getSexTypes())
            .eq("jiaoshi_id_number", jiaoshi.getJiaoshiIdNumber())
            .eq("jiaoshi_phone", jiaoshi.getJiaoshiPhone())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
        JiaoshiEntity jiaoshiEntity = jiaoshiService.selectOne(queryWrapper);
        if("".equals(jiaoshi.getJiaoshiPhoto()) || "null".equals(jiaoshi.getJiaoshiPhoto())){
                jiaoshi.setJiaoshiPhoto(null);
        }
        if(jiaoshiEntity==null){
            //  String role = String.valueOf(request.getSession().getAttribute("role"));
            //  if("".equals(role)){
            //      jiaoshi.set
            //  }
            jiaoshiService.updateById(jiaoshi);//根据id更新
            return R.ok();
        }else {
            return R.error(511,"账户或者身份证号或者手机号已经被使用");
        }
    }



    /**
    * 删除
    */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
        logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString());
        jiaoshiService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }

    /**
    * 登录
    */
    @IgnoreAuth
    @RequestMapping(value = "/login")
    public R login(String username, String password, String captcha, HttpServletRequest request) {
        JiaoshiEntity jiaoshi = jiaoshiService.selectOne(new EntityWrapper<JiaoshiEntity>().eq("username", username));
        if(jiaoshi==null || !jiaoshi.getPassword().equals(password)) {
            return R.error("账号或密码不正确");
        }
        String token = tokenService.generateToken(jiaoshi.getId(),username, "jiaoshi", "教师");
        R r = R.ok();
        r.put("token", token);
        r.put("role","教师");
        r.put("username",jiaoshi.getJiaoshiName());
        r.put("tableName","jiaoshi");
        r.put("userId",jiaoshi.getId());
        return r;
    }

    /**
    * 注册
    */
    @IgnoreAuth
    @PostMapping(value = "/register")
    public R register(@RequestBody JiaoshiEntity jiaoshi){
    //    	ValidatorUtils.validateEntity(user);
        if(jiaoshiService.selectOne(new EntityWrapper<JiaoshiEntity>().eq("username", jiaoshi.getUsername()).orNew().eq("jiaoshi_phone",jiaoshi.getJiaoshiPhone()).orNew().eq("jiaoshi_id_number",jiaoshi.getJiaoshiIdNumber())) !=null) {
            return R.error("账户已存在或手机号或身份证号已经被使用");
        }
        jiaoshiService.insert(jiaoshi);
        return R.ok();
    }

    /**
     * 重置密码
     */
    @GetMapping(value = "/resetPassword")
    public R resetPassword(Integer  id){
        JiaoshiEntity jiaoshi = new JiaoshiEntity();
        jiaoshi.setPassword("123456");
        jiaoshi.setId(id);
        jiaoshiService.updateById(jiaoshi);
        return R.ok();
    }

    /**
    * 获取教师的session教师信息
    */
    @RequestMapping("/session")
    public R getCurrJiaoshi(HttpServletRequest request){
        Integer id = (Integer)request.getSession().getAttribute("userId");
        JiaoshiEntity jiaoshi = jiaoshiService.selectById(id);
        return R.ok().put("data", jiaoshi);
    }


    /**
    * 退出
    */
    @GetMapping(value = "logout")
    public R logout(HttpServletRequest request) {
        request.getSession().invalidate();
        return R.ok("退出成功");
    }



    /**
    * 前端列表
    */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params, HttpServletRequest request){
        logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params));
        String role = String.valueOf(request.getSession().getAttribute("role"));
        if(StringUtil.isNotEmpty(role) && "学生".equals(role)){
            params.put("yonghuId",request.getSession().getAttribute("userId"));
        } if(StringUtil.isNotEmpty(role) && "教师".equals(role)){
            params.put("jiaoshiId",request.getSession().getAttribute("userId"));
        }
        // 没有指定排序字段就默认id倒序
        if(StringUtil.isEmpty(String.valueOf(params.get("orderBy")))){
            params.put("orderBy","id");
        }
        PageUtils page = jiaoshiService.queryPage(params);

        //字典表数据转换
        List<JiaoshiView> list =(List<JiaoshiView>)page.getList();
        for(JiaoshiView c:list){
            //修改对应字典表字段
            dictionaryService.dictionaryConvert(c);
        }
        return R.ok().put("data", page);
    }

    /**
    * 前端详情
    */
    @RequestMapping("/detail/{id}")
    public R detail(@PathVariable("id") Long id){
        logger.debug("detail方法:,,Controller:{},,id:{}",this.getClass().getName(),id);
        JiaoshiEntity jiaoshi = jiaoshiService.selectById(id);
            if(jiaoshi !=null){
                //entity转view
        JiaoshiView view = new JiaoshiView();
                BeanUtils.copyProperties( jiaoshi , view );//把实体数据重构到view中

                //修改对应字典表字段
                dictionaryService.dictionaryConvert(view);
                return R.ok().put("data", view);
            }else {
                return R.error(511,"查不到数据");
            }
    }


    /**
    * 前端保存
    */
    @RequestMapping("/add")
    public R add(@RequestBody JiaoshiEntity jiaoshi, HttpServletRequest request){
        logger.debug("add方法:,,Controller:{},,jiaoshi:{}",this.getClass().getName(),jiaoshi.toString());
        Wrapper<JiaoshiEntity> queryWrapper = new EntityWrapper<JiaoshiEntity>()
            .eq("username", jiaoshi.getUsername())
            .eq("password", jiaoshi.getPassword())
            .eq("jiaoshi_name", jiaoshi.getJiaoshiName())
            .eq("sex_types", jiaoshi.getSexTypes())
            .eq("jiaoshi_id_number", jiaoshi.getJiaoshiIdNumber())
            .eq("jiaoshi_phone", jiaoshi.getJiaoshiPhone())
            ;
        logger.info("sql语句:"+queryWrapper.getSqlSegment());
    JiaoshiEntity jiaoshiEntity = jiaoshiService.selectOne(queryWrapper);
        if(jiaoshiEntity==null){
            jiaoshi.setCreateTime(new Date());
        jiaoshi.setPassword("123456");
        //  String role = String.valueOf(request.getSession().getAttribute("role"));
        //  if("".equals(role)){
        //      jiaoshi.set
        //  }
        jiaoshiService.insert(jiaoshi);
            return R.ok();
        }else {
            return R.error(511,"账户或者身份证号或者手机号已经被使用");
        }
    }


}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

程序猿毕业分享网

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值