基于SSM的大学学生成长系统

news2024/10/2 14:38:12

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


目录

一、项目简介

二、系统功能

三、系统项目截图

四、核心代码

登录相关

文件上传

封装


一、项目简介

随着互联网技术的发展,各类网站应运而生,网站具有新颖、展现全面的特点。因此,为了满足阜阳师范大学学生成长管理的需求,特开发了本阜阳师范大学学生成长系统。

本阜阳师范大学学生成长系统采用Java技术,基于SSM框架、B/S结构进行开发,同时使用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/1180219.html

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

相关文章

5+单基因泛癌范文式教学,适合小白学习

今天给同学们分享一篇生信文章“Comprehensive Pan-Cancer Analysis of KIF18A as a Marker for Prognosis and Immunity”&#xff0c;这篇文章发表在Biomolecules期刊上&#xff0c;影响因子为5.5。 结果解读&#xff1a; KIF18A的表达及其在泛癌中的诊断价值 TIMER数据库被…

操作系统:虚拟存储管理技术

文章目录 虚拟存储管理技术一、实验目的二、实验要求与内容、过程与结果 系列文章 虚拟存储管理技术 一、实验目的 存储管理的主要功能之一是合理地分配空间。请求页式管理是一种常用的虚拟存储管理技术。 本实验的目的是通过请求页式存储管理中页面置换算法模拟设计&#xf…

wpf Grid布局详解 `Auto` 和 `*` 是两种常见的设置方式 行或列占多个单元格,有点像excel里的合并单元格。使其余的列平均分配剩余的空间

比如只有行的界面 <Window x:Class"GenerateTokenApp.MainWindow"xmlns"http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x"http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d"http://schemas.microsoft.com/exp…

GoLong的学习之路(二十)进阶,语法之反射(reflect包)

这个是为了接上之前的语法篇的。按照我的学习计划&#xff0c;这里此时应该有一个小项目来做一个统合。但是吧&#xff0c;突然觉得&#xff0c;似乎也没必要。能学go的大部分肯定都是有其他语言的基础的。 接下来说反射 文章目录 反射介绍reflect包TypeOftype name和type kin…

重磅!OpenAI发布GPT-4 Turbo,史上最强ChatGPT来了!

11月7日凌晨&#xff0c;OpenAI在美国旧金山举办首届开发者大会&#xff0c;与来自全球的开发者、企业、合作伙伴分享了最新产品。 微软首席执行官Satya Nadella作为特邀嘉宾出席了此次盛会。 会上&#xff0c;OpenAI发布了128K 上下文的GPT-4 Turbo、自定义GPT、DALLE 3 API…

vscode中 vue3+ts 项目的提示失效,volar插件失效问题解决方案

文章目录 前情提要bug回顾解决方案最后 前情提要 说起来很耻辱&#xff0c;从mac环境换到window环境&#xff0c;vscode的配置都是云端更新过来的&#xff0c;应该是一切正常才对&#xff0c;奇怪的是我的项目环境出现问题了&#xff0c;关于组件的ts和追踪都没有效果&#xff…

Ansible入门—安装部署及各个模块应用案例(超详细)

目录 前言 一、环境概况 修改主机名&#xff08;可选项&#xff09; 二、安装部署 1.安装epel扩展源 2.安装Ansible 3.修改Ansible的hosts文件 4.生成密钥 三、Ansible模块使用介绍 Command模块 Shell模块 User模块 Copy模块 File模块 Hostname模块 Yum模块 Se…

企业数字展厅该如何设计?

设计企业数字展厅涉及创建一个虚拟空间&#xff0c;以引人入胜的沉浸式方式展示公司的产品、服务和品牌。以下步骤可帮助设计有效的数字展厅&#xff1a; 1.定义目标&#xff1a; 确定数字展厅的用途。是为了潜在客户开发、产品展示、品牌推广还是其他目的&#xff1f;明确的…

LoRaWan模块应用于智慧城市景观灯

智能路灯作为一种新型的市政公用设施&#xff0c;它不仅具备了常规的照明能力&#xff0c;还具备各种智能装置和感应器&#xff0c;能够实现对太阳的自发充电&#xff1b;视频监控&#xff0c;环境监测等多种应用。智能路灯集成了各种新型的设备&#xff0c;是智慧都市的基础&a…

还在按键进入BIOS?其实进入BIOS有更便捷的方法

在能够配置各种硬件参数之前,首先必须学习进入ASUS BIOS实用程序的正确方法。无论你面对的是PRIME、ROG、TUF GAMING还是任何其他型号,所涉及的步骤都是相同的。 华硕主板的BIOS访问键通常是“F2”或“Del”键。在启动或启动屏幕期间,只要ASUS徽标出现,就重复按下此键以进…

响应式建筑地产工程企业网站模板源码带后台

模板信息&#xff1a; 模板编号&#xff1a;9157 模板编码&#xff1a;UTF8 模板颜色&#xff1a;多色 模板分类&#xff1a;基建、施工、地产、物业 适合行业&#xff1a;建筑施工类企业 模板介绍&#xff1a; 本模板自带eyoucms内核&#xff0c;无需再下载eyou系统&#xf…

nuxt项目:vant打包后样式顺序错乱问题及解决方案

不要引入vant/nuxt这个 需要的时候引入即可

C++ set 的使用

set 的介绍 set是按照一定次序存储元素的容器在set中&#xff0c;元素的value也标识它(value就是key&#xff0c;类型为T)&#xff0c;并且每个value必须是唯一的。 set中的元素不能在容器中修改(元素总是const)&#xff0c;但是可以从容器中插入或删除它们。在内部&#xff0…

CSS时间线样式

css实现时间线样式&#xff0c;效果如下图&#xff1a; 一、CSS代码 .timeline {padding-left: 5px} .timeline-item { position: relative;padding-bottom: 20px;} .timeline-axis {position: absolute;left: -5px;top: 0;z-index: 10;width: 20px;height: 20px;line-he…

抢购狂欢:跨境电商的区域购物节

随着全球贸易的不断扩展和数字化技术的崭新发展&#xff0c;跨境电商行业已经蓬勃发展&#xff0c;为消费者和商家带来了前所未有的便捷和机会。 其中&#xff0c;区域购物节已成为跨境电商领域的一大亮点&#xff0c;为在线消费者和电商平台提供了一个令人兴奋的购物体验。本…

在web页面音视频录制并下载到本地——MediaRecorder

音视频录制前需要获取到流&#xff0c;使用 navigator.mediaDevices 来完成。 navigator.mediaDevices MediaDevices 接口提供访问连接媒体输入的设备&#xff0c;如照相机和麦克风&#xff0c;以及屏幕共享等。它可以使你取得任何硬件资源的媒体数据。 简单介绍一下MediaDe…

外贸SEO前景怎么样?外贸网站优化的方法?

网站做外贸SEO的前景如何&#xff1f;谷歌SEO对海洋建站的影响&#xff1f; 外贸SEO前景一直备受关注&#xff0c;特别是在全球化经济的今天。随着跨境电子商务的崛起&#xff0c;外贸企业越来越重视搜索引擎优化来提升他们的在线可见性。顺风船将探讨外贸SEO前景的各个方面&a…

Synchronized关键字使用不合理,导致的多线程下线程阻塞问题排查

在为客户进行性能诊断调优时&#xff0c;碰到了一个Synchronized关键字使用不合理导致多线程下线程阻塞的情况。用文字记录下了问题的整个发现-排查-分析-优化过程&#xff0c;排查过程中使用了商业化产品——XLand性能分析平台&#xff0c;通过文章主要希望跟大家分享下分析和…

pycharm pro v2023.2.4(Python开发)

PyCharm是一种Python集成开发环境&#xff08;IDE&#xff09;&#xff0c;PyCharm提供了强大的功能&#xff0c;包括语法突出显示、智能代码完成、代码检查、自动重构和调试等特性&#xff0c;这些都可以帮助Python开发人员更加高效地编写代码。 PyCharm Pro是PyCharm的高级版…

SSM整合redis及redis的注解式开发和解决Redis缓存问题

一.SSM整合Redis 1.pom配置 用于解决运行时没有将数据库配置信息jdbc.properites加载到target文件中 <resource><directory>src/main/resources</directory><includes><include>*.properties</include><include>*.xml</includ…