大家好,我是java1234_小锋老师,看到一个不错的SpringBoot+Vue学生信息管理管理系统,分享下哈。
项目视频演示
【免费】SpringBoot+Vue学生信息管理系统 Java毕业设计_哔哩哔哩_bilibili
项目介绍
人类现已进入21世纪,科技日新月异,经济、信息等方面都取得了长足的进步,特别是信息网络技术的飞速发展,对政治、经济、军事、文化等方面都产生了很大的影响。
利用计算机网络的便利,开发一套基于java的大学生信息管理系统,将会给人们的生活带来更多的便利,而且在经济效益上,也会有很大的便利!这可以节省大量的时间和金钱。学生信息管理系统是学校不可缺少的一个环节,其内容直接关系到学生、教师和管理者。系统主要完成个人中心、学生管理、教师管理、公告通知管理、课程类型管理、课程信息管理、选课信息管理、课程成绩管理、毕业信息管理、学生考勤管理、综合素质管理等功能。方便管理员随时随地,只要计算机联网,就可以对学生信息进行管理。同时,也可以方便的查询自己的学生信息。
本论文对学生信息管理系统的需求分析、功能设计、系统设计进行了详细的阐述,并对系统的总体设计进行了阐述,并对各功能的实现和主要功能进行了说明,并附上了相应的操作界面图。
系统展示
部分代码
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.UsersEntity;
import com.service.TokenService;
import com.service.UsersService;
import com.utils.CommonUtil;
import com.utils.MPUtil;
import com.utils.PageUtils;
import com.utils.R;
import com.utils.ValidatorUtils;
/**
* 登录相关
*/
@RequestMapping("users")
@RestController
public class UsersController{
@Autowired
private UsersService userService;
@Autowired
private TokenService tokenService;
/**
* 登录
*/
@IgnoreAuth
@PostMapping(value = "/login")
public R login(String username, String password, String captcha, HttpServletRequest request) {
UsersEntity user = userService.selectOne(new EntityWrapper<UsersEntity>().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 UsersEntity user){
// ValidatorUtils.validateEntity(user);
if(userService.selectOne(new EntityWrapper<UsersEntity>().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){
UsersEntity user = userService.selectOne(new EntityWrapper<UsersEntity>().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,UsersEntity user){
EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
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( UsersEntity user){
EntityWrapper<UsersEntity> ew = new EntityWrapper<UsersEntity>();
ew.allEq(MPUtil.allEQMapPre( user, "user"));
return R.ok().put("data", userService.selectListView(ew));
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
public R info(@PathVariable("id") String id){
UsersEntity 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");
UsersEntity user = userService.selectById(id);
return R.ok().put("data", user);
}
/**
* 保存
*/
@PostMapping("/save")
public R save(@RequestBody UsersEntity user){
// ValidatorUtils.validateEntity(user);
if(userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername())) !=null) {
return R.error("用户已存在");
}
userService.insert(user);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody UsersEntity user){
// ValidatorUtils.validateEntity(user);
UsersEntity u = userService.selectOne(new EntityWrapper<UsersEntity>().eq("username", user.getUsername()));
if(u!=null && u.getId()!=user.getId() && u.getUsername().equals(user.getUsername())) {
return R.error("用户名已存在。");
}
userService.updateById(user);//全部更新
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] ids){
userService.deleteBatchIds(Arrays.asList(ids));
return R.ok();
}
}
<template>
<div>
<div class="container" :style='{"minHeight":"100vh","alignItems":"center","background":"url(http://codegen.caihongy.cn/20210916/dc10922bc8e745488075a9d66d3bf6f3.jpg)","display":"flex","width":"100%","backgroundSize":"100% 100%","backgroundPosition":"center center","backgroundRepeat":"no-repeat","justifyContent":"center"}'>
<el-form :style='{"border":"20px solid #b7c7e3","padding":"40px 20px 20px","margin":"0px 40% 0 0","borderRadius":"0px","background":"rgba(255,255,255,.95)","width":"600px","height":"auto"}'>
<div v-if="true" :style='{"width":"100%","margin":"0 0 20px 0","lineHeight":"44px","fontSize":"24px","color":"#333","textAlign":"center"}' class="title-container">学生信息管理系统登录</div>
<div v-if="loginType==1" class="list-item" :style='{"width":"80%","margin":"0 auto 30px","alignItems":"center","flexWrap":"wrap","display":"flex"}'>
<div v-if="false" class="lable" :style='{"width":"64px","lineHeight":"44px","fontSize":"14px","color":"rgba(64, 158, 255, 1)"}'>用户名</div>
<input :style='{"border":"1px solid #b7c7e3","padding":"0 10px","borderColor":"#fff","color":"#17a1e5","borderRadius":"4px","borderWidth":"0 0 2px","background":"none","width":"100%","fontSize":"14px","borderStyle":"solid","height":"44px"}' placeholder="请输入用户名" name="username" type="text" v-model="rulesForm.username">
</div>
<div v-if="loginType==1" class="list-item" :style='{"width":"80%","margin":"0 auto 30px","alignItems":"center","flexWrap":"wrap","display":"flex"}'>
<div v-if="false" class="lable" :style='{"width":"64px","lineHeight":"44px","fontSize":"14px","color":"rgba(64, 158, 255, 1)"}'>密码:</div>
<input :style='{"border":"1px solid #b7c7e3","padding":"0 10px","borderColor":"#fff","color":"#17a1e5","borderRadius":"4px","borderWidth":"0 0 2px","background":"none","width":"100%","fontSize":"14px","borderStyle":"solid","height":"44px"}' placeholder="请输入密码" name="password" type="password" v-model="rulesForm.password">
</div>
<div :style='{"width":"80%","margin":"30px auto"}' v-if="roles.length>1" prop="loginInRole" class="list-type">
<el-radio v-for="item in roles" v-bind:key="item.roleName" v-model="rulesForm.role" :label="item.roleName">{{item.roleName}}</el-radio>
</div>
<div :style='{"width":"auto","margin":"40px 0 0 55px","alignItems":"left","flexWrap":"wrap","justifyContent":"center","display":"flex"}'>
<el-button v-if="loginType==1" :style='{"border":"0","cursor":"pointer","padding":"0 20px","margin":"0 5px","outline":"none","color":"#fff","borderRadius":"4px","background":"#4a74bc","width":"auto","fontSize":"14px","height":"44px"}' type="primary" @click="login()" class="loginInBt">登录</el-button>
<el-button :style='{"border":"1px solid #4a74bc","cursor":"pointer","padding":"0 10px","margin":"0 5px","outline":"none","color":"#4a74bc","borderRadius":"4px","background":"rgba(255,255,255,0)","width":"auto","fontSize":"14px","height":"44px"}' type="primary" @click="register('xuesheng')" class="register">注册学生</el-button>
<el-button :style='{"border":"1px solid #4a74bc","cursor":"pointer","padding":"0 10px","margin":"0 5px","outline":"none","color":"#4a74bc","borderRadius":"4px","background":"rgba(255,255,255,0)","width":"auto","fontSize":"14px","height":"44px"}' type="primary" @click="register('jiaoshi')" class="register">注册教师</el-button>
</div>
</el-form>
</div>
</div>
</template>
<script>
import menu from "@/utils/menu";
export default {
data() {
return {
baseUrl:this.$base.url,
loginType: 1,
rulesForm: {
username: "",
password: "",
role: "",
code: '',
},
menus: [],
roles: [],
tableName: "",
codes: [{
num: 1,
color: '#000',
rotate: '10deg',
size: '16px'
},{
num: 2,
color: '#000',
rotate: '10deg',
size: '16px'
},{
num: 3,
color: '#000',
rotate: '10deg',
size: '16px'
},{
num: 4,
color: '#000',
rotate: '10deg',
size: '16px'
}],
};
},
mounted() {
let menus = menu.list();
this.menus = menus;
for (let i = 0; i < this.menus.length; i++) {
if (this.menus[i].hasBackLogin=='是') {
this.roles.push(this.menus[i])
}
}
},
created() {
this.getRandCode()
},
destroyed() {
},
methods: {
//注册
register(tableName){
this.$storage.set("loginTable", tableName);
this.$storage.set("pageFlag", "register");
this.$router.push({path:'/register'})
},
// 登陆
login() {
if (!this.rulesForm.username) {
this.$message.error("请输入用户名");
return;
}
if (!this.rulesForm.password) {
this.$message.error("请输入密码");
return;
}
if(this.roles.length>1) {
if (!this.rulesForm.role) {
this.$message.error("请选择角色");
return;
}
let menus = this.menus;
for (let i = 0; i < menus.length; i++) {
if (menus[i].roleName == this.rulesForm.role) {
this.tableName = menus[i].tableName;
}
}
} else {
this.tableName = this.roles[0].tableName;
this.rulesForm.role = this.roles[0].roleName;
}
this.$http({
url: `${this.tableName}/login?username=${this.rulesForm.username}&password=${this.rulesForm.password}`,
method: "post"
}).then(({ data }) => {
if (data && data.code === 0) {
this.$storage.set("Token", data.token);
this.$storage.set("role", this.rulesForm.role);
this.$storage.set("sessionTable", this.tableName);
this.$storage.set("adminName", this.rulesForm.username);
this.$router.replace({ path: "/index/" });
} else {
this.$message.error(data.msg);
}
});
},
getRandCode(len = 4){
this.randomString(len)
},
randomString(len = 4) {
let chars = [
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
"S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2",
"3", "4", "5", "6", "7", "8", "9"
]
let colors = ["0", "1", "2","3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"]
let sizes = ['14', '15', '16', '17', '18']
let output = [];
for (let i = 0; i < len; i++) {
// 随机验证码
let key = Math.floor(Math.random()*chars.length)
this.codes[i].num = chars[key]
// 随机验证码颜色
let code = '#'
for (let j = 0; j < 6; j++) {
let key = Math.floor(Math.random()*colors.length)
code += colors[key]
}
this.codes[i].color = code
// 随机验证码方向
let rotate = Math.floor(Math.random()*60)
let plus = Math.floor(Math.random()*2)
if(plus == 1) rotate = '-'+rotate
this.codes[i].rotate = 'rotate('+rotate+'deg)'
// 随机验证码字体大小
let size = Math.floor(Math.random()*sizes.length)
this.codes[i].size = sizes[size]+'px'
}
},
}
};
</script>
<style lang="scss" scoped>
.container {
min-height: 100vh;
position: relative;
background-repeat: no-repeat;
background-position: center center;
background-size: cover;
background: url(http://codegen.caihongy.cn/20210916/dc10922bc8e745488075a9d66d3bf6f3.jpg);
.list-item /deep/ .el-input .el-input__inner {
border: 1px solid #b7c7e3;
border-radius: 4px;
padding: 0 10px;
color: #17a1e5;
background: none;
width: 100%;
font-size: 14px;
border-color: #fff;
border-width: 0 0 2px;
border-style: solid;
height: 44px;
}
.list-code /deep/ .el-input .el-input__inner {
border-radius: 4px;
padding: 0 20px;
outline: none;
margin: 0 20px 0 0;
color: #17a1e5;
background: none;
width: calc(100% - 100px);
font-size: 14px;
border-color: #b7c7e3;
border-width: 1px;
border-style: solid;
height: 44px;
}
.list-type /deep/ .el-radio__input .el-radio__inner {
background: rgba(53, 53, 53, 0);
border-color: #666;
}
.list-type /deep/ .el-radio__input.is-checked .el-radio__inner {
background: #4a74bc;
border-color: #4a74bc;
}
.list-type /deep/ .el-radio__label {
color: #666;
font-size: 14px;
}
.list-type /deep/ .el-radio__input.is-checked+.el-radio__label {
color: #4a74bc;
font-size: 14px;
}
}
</style>
源码代码
链接:https://pan.baidu.com/s/1q4tUCVSsDt-etj69Z2v-Uw
提取码:1234