基于SpringBoot的教学辅助平台

news2025/6/23 12:50:50

目录

前言

 一、技术栈

二、系统功能介绍

学生信息管理

教师信息管理

课程信息管理

科目分类管理

班级分类管理

课程作业管理

交流论坛管理

三、核心代码

1、登录模块

 2、文件上传模块

3、代码封装


前言

随着信息技术在管理上越来越深入而广泛的应用,管理信息系统的实施在技术上已逐步成熟。本文介绍了教学辅助平台的开发全过程。通过分析教学辅助平台管理的不足,创建了一个计算机管理教学辅助平台的方案。文章介绍了教学辅助平台的系统分析部分,包括可行性分析等,系统设计部分主要介绍了系统功能设计和数据库设计。

本教学辅助平台管理员功能有个人中心,学生管理,教师管理,课程信息管理,科目分类管理,班级分类管理,课程作业管理,交流论坛,系统管理等。教师功能有个人中心,课程信息管理,课程作业管理,作业提交管理,作业批改管理。学生功能有个人中心,作业提交管理,作业批改管理。因而具有一定的实用性。

本站是一个B/S模式系统,采用Spring Boot框架,MYSQL数据库设计开发,充分保证系统的稳定性。系统具有界面清晰、操作简单,功能齐全的特点,使得教学辅助平台管理工作系统化、规范化。本系统的使用使管理人员从繁重的工作中解脱出来,实现无纸化办公,能够有效的提高教学辅助平台管理效率。

 一、技术栈

末尾获取源码
SpringBoot+Vue+JS+ jQuery+Ajax...

二、系统功能介绍

学生信息管理

管理员可以对学生信息进行添加修改删除操作。

教师信息管理

管理员可以对教师信息进行添加修改删除操作。

 

课程信息管理

管理员可以对课程信息进行查询删除操作。

科目分类管理

管理员可以对科目分类进行添加修改删除操作。

 

班级分类管理

管理员可以对班级分类进行添加,修改,删除操作。

课程作业管理

管理员可以对课程作业进行查看,课程作业是教师发布,学生提交的。

 

交流论坛管理

管理员可以对交流论坛内容进行回复和删除操作。

三、核心代码

1、登录模块

 
package com.controller;
 
 
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.TokenEntity;
import com.entity.UserEntity;
import com.service.TokenService;
import com.service.UserService;
import com.utils.CommonUtil;
import com.utils.MD5Util;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;
 
/**
 * 登录相关
 */
@RequestMapping("users")
@RestController
public class UserController{
	
	@Autowired
	private UserService userService;
	
	@Autowired
	private TokenService tokenService;
 
	/**
	 * 登录
	 */
	@IgnoreAuth
	@PostMapping(value = "/login")
	public R login(String username, String password, String captcha, HttpServletRequest request) {
		UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
		if(user==null || !user.getPassword().equals(password)) {
			return R.error("账号或密码不正确");
		}
		String token = tokenService.generateToken(user.getId(),username, "users", user.getRole());
		return R.ok().put("token", token);
	}
	
	/**
	 * 注册
	 */
	@IgnoreAuth
	@PostMapping(value = "/register")
	public R register(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }
 
	/**
	 * 退出
	 */
	@GetMapping(value = "logout")
	public R logout(HttpServletRequest request) {
		request.getSession().invalidate();
		return R.ok("退出成功");
	}
	
	/**
     * 密码重置
     */
    @IgnoreAuth
	@RequestMapping(value = "/resetPass")
    public R resetPass(String username, HttpServletRequest request){
    	UserEntity user = userService.selectOne(new EntityWrapper<UserEntity>().eq("username", username));
    	if(user==null) {
    		return R.error("账号不存在");
    	}
    	user.setPassword("123456");
        userService.update(user,null);
        return R.ok("密码已重置为:123456");
    }
	
	/**
     * 列表
     */
    @RequestMapping("/page")
    public R page(@RequestParam Map<String, Object> params,UserEntity user){
        EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
    	PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params));
        return R.ok().put("data", page);
    }
 
	/**
     * 列表
     */
    @RequestMapping("/list")
    public R list( UserEntity user){
       	EntityWrapper<UserEntity> ew = new EntityWrapper<UserEntity>();
      	ew.allEq(MPUtil.allEQMapPre( user, "user")); 
        return R.ok().put("data", userService.selectListView(ew));
    }
 
    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    public R info(@PathVariable("id") String id){
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
    
    /**
     * 获取用户的session用户信息
     */
    @RequestMapping("/session")
    public R getCurrUser(HttpServletRequest request){
    	Long id = (Long)request.getSession().getAttribute("userId");
        UserEntity user = userService.selectById(id);
        return R.ok().put("data", user);
    }
 
    /**
     * 保存
     */
    @PostMapping("/save")
    public R save(@RequestBody UserEntity user){
//    	ValidatorUtils.validateEntity(user);
    	if(userService.selectOne(new EntityWrapper<UserEntity>().eq("username", user.getUsername())) !=null) {
    		return R.error("用户已存在");
    	}
        userService.insert(user);
        return R.ok();
    }
 
    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserEntity user){
//        ValidatorUtils.validateEntity(user);
        userService.updateById(user);//全部更新
        return R.ok();
    }
 
    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Long[] ids){
        userService.deleteBatchIds(Arrays.asList(ids));
        return R.ok();
    }
}

 2、文件上传模块

package com.controller;
 
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.UUID;
 
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
import com.annotation.IgnoreAuth;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.entity.ConfigEntity;
import com.entity.EIException;
import com.service.ConfigService;
import com.utils.R;
 
/**
 * 上传文件映射表
 */
@RestController
@RequestMapping("file")
@SuppressWarnings({"unchecked","rawtypes"})
public class FileController{
	@Autowired
    private ConfigService configService;
	/**
	 * 上传文件
	 */
	@RequestMapping("/upload")
	public R upload(@RequestParam("file") MultipartFile file,String type) throws Exception {
		if (file.isEmpty()) {
			throw new EIException("上传文件不能为空");
		}
		String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1);
		File path = new File(ResourceUtils.getURL("classpath:static").getPath());
		if(!path.exists()) {
		    path = new File("");
		}
		File upload = new File(path.getAbsolutePath(),"/upload/");
		if(!upload.exists()) {
		    upload.mkdirs();
		}
		String fileName = new Date().getTime()+"."+fileExt;
		File dest = new File(upload.getAbsolutePath()+"/"+fileName);
		file.transferTo(dest);
		FileUtils.copyFile(dest, new File("C:\\Users\\Desktop\\jiadian\\springbootl7own\\src\\main\\resources\\static\\upload"+"/"+fileName));
		if(StringUtils.isNotBlank(type) && type.equals("1")) {
			ConfigEntity configEntity = configService.selectOne(new EntityWrapper<ConfigEntity>().eq("name", "faceFile"));
			if(configEntity==null) {
				configEntity = new ConfigEntity();
				configEntity.setName("faceFile");
				configEntity.setValue(fileName);
			} else {
				configEntity.setValue(fileName);
			}
			configService.insertOrUpdate(configEntity);
		}
		return R.ok().put("file", fileName);
	}
	
	/**
	 * 下载文件
	 */
	@IgnoreAuth
	@RequestMapping("/download")
	public ResponseEntity<byte[]> download(@RequestParam String fileName) {
		try {
			File path = new File(ResourceUtils.getURL("classpath:static").getPath());
			if(!path.exists()) {
			    path = new File("");
			}
			File upload = new File(path.getAbsolutePath(),"/upload/");
			if(!upload.exists()) {
			    upload.mkdirs();
			}
			File file = new File(upload.getAbsolutePath()+"/"+fileName);
			if(file.exists()){
				/*if(!fileService.canRead(file, SessionManager.getSessionUser())){
					getResponse().sendError(403);
				}*/
				HttpHeaders headers = new HttpHeaders();
			    headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);    
			    headers.setContentDispositionFormData("attachment", fileName);    
			    return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return new ResponseEntity<byte[]>(HttpStatus.INTERNAL_SERVER_ERROR);
	}
	
}

3、代码封装

package com.utils;
 
import java.util.HashMap;
import java.util.Map;
 
/**
 * 返回数据
 */
public class R extends HashMap<String, Object> {
	private static final long serialVersionUID = 1L;
	
	public R() {
		put("code", 0);
	}
	
	public static R error() {
		return error(500, "未知异常,请联系管理员");
	}
	
	public static R error(String msg) {
		return error(500, msg);
	}
	
	public static R error(int code, String msg) {
		R r = new R();
		r.put("code", code);
		r.put("msg", msg);
		return r;
	}
 
	public static R ok(String msg) {
		R r = new R();
		r.put("msg", msg);
		return r;
	}
	
	public static R ok(Map<String, Object> map) {
		R r = new R();
		r.putAll(map);
		return r;
	}
	
	public static R ok() {
		return new R();
	}
 
	public R put(String key, Object value) {
		super.put(key, value);
		return this;
	}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1086283.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

一步步教你如何搭建家政小程序+家政管理系统

在当今数字化时代&#xff0c;家政服务行业也需要紧跟潮流&#xff0c;借助互联网技术提升服务品质和效率。而小程序作为一种轻量级应用&#xff0c;能够帮助家政服务公司在推广、预约、评价等方面实现便捷操作&#xff0c;吸引更多客户。本文将介绍如何轻松搭建家政服务行业的…

那些年你不一定会的磁盘、目录、文件操作(c语言版)

一、前言 今天和大家分享的是使用win32api操作磁盘&#xff0c;目录&#xff0c;文件&#xff0c;这里分为三大块&#xff0c;希望能帮到大家。在讲之前还是先给大家看看效果图&#xff0c;如下图&#xff1a; 二、磁盘 获取盘符下的所有文件夹.rar: https://url18.ctfile.co…

H3C交换机的40G堆叠线 ,可以插在普通光口做堆叠吗?

环境&#xff1a; S6520X-24ST-SI交换机 H3C LSWM1QSTK2万兆40G堆叠线QSFP 问题描述&#xff1a; H3C交换机的40G堆叠线 &#xff0c;可以插在普通光口做堆叠吗&#xff1f; 解答&#xff1a; 1.H3C交换机的40G堆叠线通常是用于连接堆叠模块或堆叠端口的。这些堆叠线通常使…

小谈设计模式(25)—职责链模式

小谈设计模式&#xff08;25&#xff09;—职责链模式 专栏介绍专栏地址专栏介绍 职责链模式分析角色分析抽象处理者&#xff08;Handler&#xff09;具体处理者&#xff08;ConcreteHandler&#xff09;客户端&#xff08;Client&#xff09; 优缺点分析优点123 缺点12 应用场…

Flink on k8s容器日志生成原理及与Yarn部署时的日志生成模式对比

Flink on k8s部署日志详解及与Yarn部署时的日志生成模式对比 最近需要将flink由原先部署到Yarn集群切换到kubernetes集群&#xff0c;在切换之后需要熟悉flink on k8s的运行模式。在使用过程中针对日志模块发现&#xff0c;在k8s的容器中&#xff0c;flink的系统日志只有jobma…

【yolov5】改进系列——特征图可视化

文章目录 前言一、特征图可视化二、可视化指定层三、合并通道可视化总结 前言 对于特征图可视化感兴趣可以参考我的另一篇记录&#xff1a;六行代码实现&#xff1a;特征图提取与特征图可视化&#xff0c;可以实现分类网络的特征图可视化 最近忙论文&#xff0c;想在yolov5上…

使用VSCode进行linux内核代码开发(一)

0. 前言 Linux 内核代码量非常的庞大,其中又包含了各种平台的宏定义开关、配置,外加各种结构体指针的注册,这使得阅读内核代码变成一件令人头疼的事。针对这个问题常见有如下几种方案: source insight 创建项目工程。但是如上所说,对于阅读 linux 代码来说非常困难。而且…

Linux中怎么启动Zookeeper

首先进入Zookeeper安装目录下的bin目录 比如&#xff1a; cd /root/zookeeper-3.4.9/bin 然后在此目录下执行命令。 1. 启动Zookeeper Server端 ./zkServer.sh start 2.启动Zookeeper Client端 ./zkCli.sh 启动Zookeeper Client端后如下&#xff1a;

接口自动化测试_L1

目录&#xff1a; 接口自动化测试框架介绍 接口测试场景自动化测试场景接口测试在分层测试中的位置接口自动化测试与 Web/App 自动化测试对比接口自动化测试与 Web/App 自动化测试对比接口测试工具类型为什么推荐 RequestsRequests 优势Requests 环境准备接口请求方法接口请求…

Web自动化测试进阶:网页中难点之等待机制 —— 强制等待,隐式等待

为什么要添加等待 避免页面未渲染完成后操作&#xff0c;导致的报错 经常会遇到报错&#xff1a;selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":&q…

[LitCTF 2023]导弹迷踪

这道题相较于其他的分数类型的js题有一点不一样&#xff0c;他不是像常规的有用bp多次抓包修改最后得分来获取flag的。 本题将flag藏到了他的前端文件中本身没有任何难度&#xff0c;只是为了记录一种新的做法 按照我们平常做js的思路就是先随便玩一下然后bp抓包看得分或者抓包…

如何提升设备投资回报率:预测性维护在制造业的应用

在当今竞争激烈的制造业市场中&#xff0c;企业需要不断寻求提高生产效率和降低成本的方法。作为重要资产之一&#xff0c;设备投资回报率成为制造企业关注的焦点。然而&#xff0c;许多企业在设备维护和管理方面面临着一些挑战&#xff0c;这可能导致设备投资回报率的下降。为…

【重拾C语言】八、表单数据组织——结构体(类型、类型别名、直接/间接访问;典例:复数、成绩单)

目录 前言 八、结构体 8.1 结构体类型 8.2 结构体类型名 8.2.1 typedef关键字 8.2.1 结构体类型别名 8.3 结构体变量 8.3.1 使用结构体类型引用 8.3.2 使用结构体类型定义 8.3.3 使用typedef定义的结构体类型别名 8.4 访问结构体变量 8.4.1 直接成员选择表达式 8.…

如何才能找到合适的法语交传翻译服务呢?

法语交传&#xff0c;无需其他语言介入&#xff0c;直接在口译者与听众之间进行即时翻译&#xff0c;这是一种高级口译服务。法语交传在国际会议、商务谈判、法律诉讼等各种场合中发挥着至关重要的作用。那么&#xff0c;如何才能找到合适的法语交传翻译服务呢&#xff1f;法语…

2023年全球新能源动力电池盒市场发展规模及趋势分析:动力电池盒向底盘一体化方向发展[图]

中国新能源汽车市场维持高速增长的态势&#xff0c;电池盒作为在新能源汽车中用以承载、固定、保护以及集成电池组的机构部件&#xff0c;是构成新能源汽车完整动力系统的关键组成部分。2022年&#xff0c;全球新能源动力电池盒市场规模约430亿元&#xff0c;同比增长65.38%&am…

迅镭激光切割机在钣金加工行业中的应用

钣金是一种针对金属薄板(厚度通常在6mm以下)的归纳冷加工工艺&#xff0c;包括剪切、冲切、切割、复合、弯曲、焊接、铆接、拼接和成型等步骤&#xff0c;其显著特征是所有零件的厚度保持一致。 电器控制箱和机器外壳等通常都是钣金件&#xff0c;钣金加工能力的需求持续攀升&a…

JavaFx学习问题2--音频、视频播放失败情况

文章目录 一、路径注意事项&#xff1a;① 用相对路径的时候别忘了前面的斜杠② uri问题 二、播放不了的问题① 获取的媒体文件路径本身就是不对的② 必须是uri 额外收获: 一、路径注意事项&#xff1a; ① 用相对路径的时候别忘了前面的斜杠 并不是什么大问题&#xff0c;只是…

JavaScript-Vue基础语法-创建-组件-路由

文章目录 1.创建vue项目1.1.自定义创建项目1.2.项目结构解析1.3.主要文件1.4.其它 2.项目运行3.Vue组件概念3.1.组件基础概念3.2.单文件组件三要素3.3.组件注册3.4.组件通信 4.Vue路由概念4.1.简单使用4.2.路由参数4.3.嵌套路由4.4.路由导航4.5.代码导航4.6.路由守卫 5.总结 HT…

【Java 进阶篇】JavaScript `typeof` 操作符详解

JavaScript是一种弱类型语言&#xff0c;这意味着变量的数据类型通常是灵活的。为了更好地理解和操作数据&#xff0c;JavaScript提供了typeof操作符&#xff0c;它可以用来确定一个值的数据类型。在本篇博客中&#xff0c;我们将详细讨论typeof操作符&#xff0c;包括它的用法…

访问网站被拦截提示“该网站可能包含违法或违规内容”访问不了怎么办?设置一下360安全卫士即可解决

本来是一个正常的网站&#xff0c;结果被恶意举报后访问提示 该网站可能包含违法或违规内容 根据相关部门规定或投诉举报&#xff0c;此链接可能存在违反相关法律法规或政策的内容&#xff0c;建议您谨慎访问。 您访问的网址是&#xff1a;https://www.shuzhiqiang.com