基于SSM的培训学校教学管理平台的设计与实现

news2024/10/7 3:30:07

末尾获取源码
开发语言:Java
Java开发工具:JDK1.8
后端框架:SSM
前端:Vue
数据库:MySQL5.7和Navicat管理工具结合
服务器:Tomcat8.5
开发软件:IDEA / Eclipse
是否Maven项目:是


目录

一、项目简介

二、系统功能

三、系统项目截图

登录模块的实现

注册模块的实现

生管理模块的实现

教师管理模块的实现

机构信息管理模块的实现

课程信息管理模块的实现

选课信息管理模块的实现

四、核心代码

登录相关

文件上传

封装


一、项目简介

社会的进步,教育行业发展迅速,人们对教育越来越重视,在当今网络普及的情况下,教学管理模式也开始逐渐网络化,学校开始网络教学管理模式。

本文研究的培训学校教学管理平台基于SSM框架,采用Java技术和MYSQL数据库设计开发。在系统的整个开发过程中,首先对系统进行了需求分析,设计出系统的主要功能模块,包括学生功能模块、教师功能模块以及管理员功能模块三大部分,其次对网站进行总体规划和详细设计,最后对培训学校教学管理平台进行了系统测试,包括测试概述,测试内容等,并对测试结果进行了分析和总结,进而得出系统的不足及需要改进的地方,为以后的系统维护和扩展提供了方便。

本系统布局合理、色彩搭配和谐、框架结构设计清晰,具有操作简单,界面清晰,管理方便,功能完善等优势,有很高的使用价值。


二、系统功能

系统架构的整体设计是一个将一个庞大的任务细分为多个小的任务的过程,这些小的任务分段完成后,组合在一起形成一个完整的任务。本培训学校教学管理平台的设计与实现主要包括学生功能模块、教师功能模块和管理员功能模块三大部分。



三、系统项目截图

登录模块的实现

用户要想进入本系统必须进行登录操作

注册模块的实现

没有账号的学生和教师均可进行注册操作

 

生管理模块的实现

管理员可查看、修改和删除学生信息

教师管理模块的实现

管理员可查看、修改和删除教师信息

 

机构信息管理模块的实现

管理员可增删改查机构信息,教师可查看机构信息,并可选择进行加盟操作

 

课程信息管理模块的实现

教师可增删改查课程信息,学生可查看课程信息,并可选择进行选课

 

选课信息管理模块的实现

教师可查看学生选课信息,并可对其进行审核操作

 


四、核心代码

登录相关


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();
    }
}

文件上传

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);
	}
	
}

封装

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/1116129.html

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

相关文章

ASCII_Util.java

package asc_ii;/*** 我写程序&#xff0c;写代码&#xff0c;做项目做产品&#xff0c;更加努力学习做人* 我曾经家里有两只狗&#xff0c;rocket就是那种小型犬吧&#xff0c;两耳朵跑起来飞舞着&#xff0c;我也不记得是不是舞蝶犬* 还有一条中型犬&#xff0c;“豆豆”&…

小程序实现后台数据交互及WXS的使用

一&#xff0c;数据交互准备工作 1.1 后端准备 后端部分代码&#xff0c;可自行创建后端代码 package com.zking.minoa.wxcontroller;import com.zking.minoa.mapper.InfoMapper; import com.zking.minoa.model.Info; import com.zking.minoa.util.ResponseUtil; import org…

FPGA【紫光语法】

寄存器数据类型&#xff1a; reg 默认为 1 bit wide&#xff0c;如果超过 1 bit&#xff0c;则需要 range declaration 设置 reg 的位宽integer 默认位宽为 32 bit&#xff0c;不允许有 range declarationtime 默认位宽为 64 bit&#xff0c;不允许有 range declarat…

黄金现货期货各有各的市场

投资黄金要获得高效的收益&#xff0c;投资者应该选择有一定资金杠杆的保证金品种&#xff0c;比如现货黄金和黄金期货就是这样投资方式&#xff0c;投资者都可以通过它们的杠杆来放大自己的收益&#xff0c;但二者始终存在区别&#xff0c;投资者到底该如何选择呢&#xff1f;…

(2023,DALL-E3,两步微调,标题重建)通过更好的标题改进图像生成

Improving Image Generation with Better Captions 公众号&#xff1a;EDPJ&#xff08;添加 VX&#xff1a;CV_EDPJ 或直接进 Q 交流群&#xff1a;922230617 获取资料&#xff09; 目录 0. 摘要 1. 简介 2. 重建数据集标题 2.1 构建图像标题器 2.1.1 微调标题器 3…

AI虚拟主播频繁亮相,未来会替代真人吗?灰豚AI数字人深度解析!

你可能听说过一些头部主播其实不是真人&#xff0c;而是由人工智能技术生成的虚拟数字人。这些数字人有着逼真的外貌、声音和表情&#xff0c;和真人几乎一模一样&#xff0c;可以在直播平台上和观众进行各种内容的展示和互动。那么&#xff0c;现在来考考你以下哪一个头部主播…

德施曼2023双十一全民换锁季,多款爆品持续引爆全民换购潮

每年双十一&#xff0c;对于各行业的商家来说都是必争之地&#xff0c;在智能锁领域也同样如此。国产高端智能锁品牌德施曼为了迎接此次双十一狂欢盛典&#xff0c;开启了双十一全民换锁季&#xff0c;携旗下多款爆品持续引爆全民换购热潮&#xff01; 德施曼全民换锁季 以旧换…

JOSEF约瑟 JJKY-30Z NK82-III检漏继电器 导轨或面板安装 0.1-50A

系列型号&#xff1a; JY82A检漏继电器 JY82B检漏继电器 JY82-380/660检漏继电器 JY82-IV检漏继电器 JY82-2P检漏继电器 JY82-2/3检漏继电器 JJKY检漏继电器 JD型检漏继电器 JY82-IV;JY82J JY82-II;JY82-III JY82-1P;JY82-2PA;JY82-2PB JJB-380;JJB-380/660 JD-12…

数据结构--线性表回顾

目录 线性表 1.定义 2.线性表的基本操作 3.顺序表的定义 3.1顺序表的实现--静态分配 3.2顺序表的实现--动态分配 4顺序表的插入、删除 4.1插入操作的时间复杂度 4.2顺序表的删除操作-时间复杂度 5 顺序表的查找 5.1按位查找 5.2 动态分配的方式 5.3按位查找的时间…

Vant Weapp的Slider组件自定义button

js部分: <van-slider v-model"value" range drag"priceChange" drag-end"sliderDragEnd" use-button-slot max"1000" min"0" step"10"><view class"custom-button" slot"left-button&…

如何使用LightPicture部署私人图床实现远程访问与图片管理?

文章目录 1.前言2. Lightpicture网站搭建2.1. Lightpicture下载和安装2.2. Lightpicture网页测试2.3.cpolar的安装和注册 3.本地网页发布3.1.Cpolar云端设置3.2.Cpolar本地设置 4.公网访问测试5.结语 1.前言 现在的手机越来越先进&#xff0c;功能也越来越多&#xff0c;而手机…

ENVI IDL:对于GEOTIFF结构体的说明

Tag标签-前言 其中最关键的只有两个标签Tag&#xff0c;一个是MODELPIXELSCALETAG&#xff0c;一个是MODELTIEPOINTTAG。 至于ModelTransformationTag我没用过不了解&#xff0c;但是应该是关于仿射变换相关的&#xff0c;用于将像素坐标与地理/投影坐标进行转换的矩阵。 对于…

2000-2021年上市公司MA并购溢价计算数据(含原始数据+Stata代码)

2000-2021年上市公司M&A并购溢价计算&#xff08;原始数据Stata代码&#xff09; 1、时间&#xff1a;2000-2021年 2、范围&#xff1a;沪深A股上市公司 3、指标&#xff1a; 原始数据指标&#xff1a;事件ID、公司ID、证券代码、业务编码、上市公司交易地位编码、首次公…

ES1:index、type、document、mapping之间的关系

1.1 引言 由于长期使用es&#xff0c;但是对于es的大体结构存在疑惑&#xff0c;于是在此做一个大致总结。 1.2 数据存储结构 在 7.0版本之前&#xff0c;es的数据结构如下&#xff1a; 提示&#xff1a; 通过上图可知&#xff0c;在7.0之前elasticsearch的结构层级是&#…

基于 Linux 0.11 讲解 Linux 操作系统的启动原理

大家好&#xff0c;我是飞哥&#xff01; 不知道大家有没有产生过一个疑问&#xff1a;从给 Linux 服务器按下开机电源按钮后到启动成功的一段时间里&#xff0c;在这中间 Linux 操作系统都做了哪些事情&#xff1f; 在 Linux 服务器没有通电的时候&#xff0c;操作系统还只是躺…

【网络安全】网站被攻击了怎么办?怎么防护DDOS、CC、XSS、ARP等攻击?

网站被攻击了怎么办&#xff1f; 六字真言&#xff1a;认怂、关站、睡觉 如果你对网络安全入门感兴趣&#xff0c;那么你需要的话可以点击这里&#x1f449;【入门&进阶全套282G学习资源包免费分享&#xff01;】 常见的网络攻击 XSS攻击 XSS 攻击可以分为 3 类&#…

【数据结构】队列(C语言实现)

&#x1f4d9; 作者简介 &#xff1a;RO-BERRY &#x1f4d7; 学习方向&#xff1a;致力于C、C、数据结构、TCP/IP、数据库等等一系列知识 &#x1f4d2; 日后方向 : 偏向于CPP开发以及大数据方向&#xff0c;欢迎各位关注&#xff0c;谢谢各位的支持 队列 1. 队列的概念及结构…

Winform中加密时提示此实现不是Windows平台FIPS验证的加密算法的一部分

场景 Java与Winform进行AES加解密数据传输的工具类与对应关系和示例&#xff1a; Java与Winform进行AES加解密数据传输的工具类与对应关系和示例_霸道流氓气质的博客-CSDN博客 winform中使用如上进行加密时提示&#xff1a; 实现不是Windows平台FIPS验证的加密算法的一部分…

Vue项目中集成TinyMCE富文本编辑器(图片批量上传等)

TinyMCE富文本在Vue中的使用 关于TinyMCE 实现效果 安装使用TinyMCE 第一步 第二步 1.官网申请Your Tiny API Key&#xff0c;并且配置访问域名&#xff1a; 2.使用css隐藏(这个就不讲了&#xff0c;不推荐使用) 3.全部由本地加载(推荐) 第三步(汉化包) 第四步(封装组…

QT使用MSVC编译时报错C2001: 常量中有换行符

QT使用MSVC编译时报错C2001: 常量中有换行符 Chapter11、QT界面菜单栏->工具->选项->文本编辑器&#xff0c;修改成如果编码是UTF-8则添加&#xff0c;如图&#xff1a;2、QT界面菜单栏->编辑->Slect Encoding...->UTF-8->按编码保存3、在需要的头文件中加…