Java项目:学生毕业离校系统(java+SpringBoot+Mybatis+Vue+ELementUI+mysql)

源码获取:俺的博客首页 "资源" 里下载! 

项目介绍

基于Springboot Vue学生毕业离校系统

角色:管理员、学生、教师三种角色,分为前后台;

学生:学生通过学生登录页面可以填写用户名和密码等信息进行登录操作,登录成功后,进入首页可以查看个人中心、离校流程、网站公告、留言反馈模块等功能模块,进行相对应操作

教师:教师登录后,进入后台系统页面可以查看个人中心、学生管理、离校流程管理、费用结算管理、论文审核管理等功能模块,进行相对应操作

管理员:管理员登录成功后进入到系统操作界面,可以对个人中心、学生管理、教师管理、离校流程管理、费用结算管理、论文审核管理、留言板管理、管理员管理、系统管理等功能模块进行相对应操作。


环境需要

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。
2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;
3.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 
4.数据库:MySql 5.7/8.0版本均可;
5.是否Maven项目:是;


技术栈

后端:SpringBoot+Mybaits

前端:Vue+ElementUI+Layui+HTML+CSS+JS


使用说明

项目运行:
1. 使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,导入成功后请执行maven clean;maven install命令;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4.运行项目,在浏览器中输入地址:
前台地址:http://localhost:8080/springbootb3dn9/front/index.html
学生:学生1/123456
教师:教师1/123456
后台地址:http://localhost:8080/springbootb3dn9/admin/dist/index.html#/login
管理员:abo/abo
学生:学生1/123456
教师:教师1/123456

系统结构:

首页展示:

网站公告:

 留言反馈:

个人中心展示:

管理员后台学生管理:

后台离校流程管理: 

费用结算管理:

后台轮播图管理:

学生管理控制层:

@Controller
@RequestMapping(value="/student")
public class StudentController {
	@Autowired
	private StudentService studentService;
	
	@ResponseBody
	@RequestMapping(value="/list")
	public String getStudentList(@RequestParam(defaultValue="0")int curr,
			@RequestParam(defaultValue="20")int nums,
			@RequestParam(defaultValue="")String searchKey) {
		
		Pagination<Student> page = new Pagination<Student>();
		
		page.setTotalItemsCount(studentService.getTotalItemsCount(searchKey));
		page.setPageSize(nums);
		page.setPageNum(curr);
		
		List<Student> list = studentService.getStudentList(page,searchKey);
		
		String jsonStr = StrUtil.RETURN_JONS_PRE_STR
				+ page.getTotalItemsCount()
				+ StrUtil.RETURN_JONS_MID_STR
				+ JSON.toJSONString(list)
				+ StrUtil.RETURN_JONS_END_STR;
		return jsonStr;
	}
	
	
	/**
	 * 返回选修了我课程的学生列表
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/stulist")
	public String getMyStudentList(@RequestParam(defaultValue="0")int curr,
			@RequestParam(defaultValue="20")int nums,
			@RequestParam(required=false) Integer cId, HttpSession session) {
		Teacher t = (Teacher) session.getAttribute(StrUtil.USER);
		Pagination<Student> page = new Pagination<Student>();
		
		page.setTotalItemsCount(studentService.getTotalItemsCountByTid(t.getId(), cId));
		page.setPageSize(nums);
		page.setPageNum(curr);
		
		List<Student> list = studentService.getStudentListByTid(page, t.getId(), cId);
		
		String jsonStr = StrUtil.RETURN_JONS_PRE_STR
				+ page.getTotalItemsCount()
				+ StrUtil.RETURN_JONS_MID_STR
				+ JSON.toJSONString(list)
				+ StrUtil.RETURN_JONS_END_STR;
		System.out.println(jsonStr);
		return jsonStr;
	}
	
	
	
	@RequestMapping(value="/addPage")
	public ModelAndView toAddPage() {
		return new ModelAndView("/studentAdd");
	}
	
	/**
	 * 增加,或者修改studnet
	 * @param opType
	 * @param stu
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/add")
	public String addStudent(@RequestParam(defaultValue="2") int opType, Student stu) {
		int res = 0;
		if (opType == 0) {
			try {
				stu.setPassword(stu.getPassword().toUpperCase());
				res = studentService.addStudent(stu);
			} catch (Exception e) {
				System.out.println("添加失败!学号重复!");
				return "添加失败!学号重复!";
			}
			if (res > 0)
				return StrUtil.RESULT_TRUE;
			return "添加失败";
		} else if (opType == 1) {
			stu.setPassword(null);
			res = studentService.updateStudent(stu);
			if (res > 0) return StrUtil.RESULT_TRUE;
			return "修改失败!";
		}
		return "error";
	}
	
	/**
	 * 重置密码
	 * @param stu
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/resetPswd")
	public String resetPasswrd(String id) {
		Student stu = new Student();
		stu.setId(id);
		stu.setPassword(MD5Util.MD5("123456"));
		if (studentService.updateStudent(stu) > 0) return StrUtil.RESULT_TRUE;
		return "修改失败!";
	}
	
	@ResponseBody
	@RequestMapping(value="/delete")
	public String deleteStudnet(Student stu) {
		if (studentService.deleteStudent(stu) > 0) return StrUtil.RESULT_TRUE;
		return "删除失败!";
	}
	
	/**
	 * 批量删除
	 * @param stuIds
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/deleteList")
	public String deleteStudnetList(String stuIds) {
		List<String> list = new ArrayList<String>();
		try {
			String[] ids = stuIds.split(",");
			for (String id: ids) {
				list.add(id);
			}
			if (studentService.deleteStudent(list) > 0) {
				return StrUtil.RESULT_TRUE;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return "删除失败!参数出错!";//
		}
		return "删除失败!";
	}
	
	@ResponseBody
	@RequestMapping("/import")  
	public String impotr(HttpServletRequest request, MultipartFile file) {  
	     //获取上传的文件  
	     InputStream in = null;
		try {
			in = file.getInputStream();
			//数据导入  
			int res = studentService.importExcelInfo(in,file);
			if (res > 0) {
				return StrUtil.RETURN_JONS_PRE_STR+"0"
						+StrUtil.RETURN_JONS_MID_STR+"true"
						+StrUtil.RETURN_JONS_END_STR;
			} else {
				return StrUtil.RETURN_JONS_PRE_STR+"0"
						+StrUtil.RETURN_JONS_MID_STR+"false"
						+StrUtil.RETURN_JONS_END_STR;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return StrUtil.RETURN_JONS_PRE_STR+"0"
			+StrUtil.RETURN_JONS_MID_STR+"error"
			+StrUtil.RETURN_JONS_END_STR;
		} finally {
			if (in != null)
				try {
					in.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
		}
	}
	
	@RequestMapping(value="/courses")
	public ModelAndView toChoiceCoursePage() {
		return new ModelAndView("choiceCourse");
	}
}

教师管理控制层: 

@Controller
@RequestMapping(value="/teacher")
public class TeacherController {
	@Autowired
	private TeacherService teacherService;
	
	@ResponseBody
	@RequestMapping(value="/list")
	public String getTeacherList(@RequestParam(defaultValue="0")int curr,@RequestParam(defaultValue="10")int nums,
			@RequestParam(defaultValue="")String searchKey) {
		Pagination<Teacher> page = new Pagination<Teacher>();
		
		page.setTotalItemsCount(teacherService.getTotalItemsCount(searchKey));
		page.setPageSize(nums);
		page.setPageNum(curr);
		List<Teacher> list = teacherService.getTeacher(page, searchKey);
		
		
		String jsonStr = StrUtil.RETURN_JONS_PRE_STR + page.getTotalItemsCount() 
				+ StrUtil.RETURN_JONS_MID_STR
				+ JSON.toJSONString(list) + StrUtil.RETURN_JONS_END_STR;
		return jsonStr;
	}
	
	@ResponseBody
	@RequestMapping(value="/listForSelect")
	public String getTeacherListForSelect(@RequestParam(defaultValue="") String searchKey) {
		List<Teacher> list = teacherService.getTeacherForSelect(searchKey);
		String jsonStr = StrUtil.RETURN_JONS_PRE_STR + list.size() 
				+ StrUtil.RETURN_JONS_MID_STR
				+ JSON.toJSONString(list) + StrUtil.RETURN_JONS_END_STR;
		return jsonStr;
	}
    
	@RequestMapping(value="/addPage")
	public ModelAndView toAddPage() {
		return new ModelAndView("/teacherAdd");
	}
	
	/**
	 * 增加,或者修改teacher
	 * @param opType
	 * @param teacher
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/add")
	public String addTeacher(@RequestParam(defaultValue="2") int opType, Teacher teacher) {
		int res = 0;
		if (opType == 0) {
			try {
				teacher.setPassword(teacher.getPassword().toUpperCase());
				res = teacherService.addTeacher(teacher);
			} catch (Exception e) {
				System.out.println("添加失败!学号重复!");
				return "添加失败!工号重复!";
			}
			if (res > 0)
				return StrUtil.RESULT_TRUE;
			return "添加失败";
		} else if (opType == 1) {
			teacher.setPassword(null);
			res = teacherService.updateTeacher(teacher);
			if (res > 0) return StrUtil.RESULT_TRUE;
			return "修改失败!";
		}
		return "error";
	}
	
	/**
	 * 重置密码
	 * @param id
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/resetPswd")
	public String resetPasswrd(String id) {
		Teacher teacher = new Teacher();
		teacher.setId(id);
		teacher.setPassword(MD5Util.MD5("123456"));
		if (teacherService.updateTeacher(teacher) > 0) return StrUtil.RESULT_TRUE;
		return "修改失败!";
	}
	
	@ResponseBody
	@RequestMapping(value="/delete")
	public String deleteStudnet(Teacher t) {
		if (teacherService.deleteTeacher(t) > 0) return StrUtil.RESULT_TRUE;
		return "删除失败!";
	}
	
	/**
	 * 批量删除
	 * @param tIds
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/deleteList")
	public String deleteStudnetList(String tIds) {
		List<String> list = new ArrayList<String>();
		try {
			String[] ids = tIds.split(",");
			for (String id: ids) {
				list.add(id);
			}
			if (teacherService.deleteTeacher(list) > 0) {
				return StrUtil.RESULT_TRUE;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return "删除失败!参数出错!";//
		}
		return "删除失败!";
	}
	
	@ResponseBody
	@RequestMapping("/import")  
	public String impotr(HttpServletRequest request, MultipartFile file) {  
	     //获取上传的文件  
	     InputStream in = null;
		try {
			in = file.getInputStream();
			//数据导入  
			int res = teacherService.importExcelInfo(in,file);
			if (res > 0) {
				return StrUtil.RETURN_JONS_PRE_STR+"0"
						+StrUtil.RETURN_JONS_MID_STR+"true"
						+StrUtil.RETURN_JONS_END_STR;
			} else {
				return StrUtil.RETURN_JONS_PRE_STR+"0"
						+StrUtil.RETURN_JONS_MID_STR+"false"
						+StrUtil.RETURN_JONS_END_STR;
			}
		} catch (Exception e) {
			e.printStackTrace();
			return StrUtil.RETURN_JONS_PRE_STR+"0"
			+StrUtil.RETURN_JONS_MID_STR+"error"
			+StrUtil.RETURN_JONS_END_STR;
		} finally {
			if (in != null)
				try {
					in.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
		}
	}
}

@Controller
@RequestMapping(value="/score")
public class ScoreController {
	@Autowired
	private ScoreService scoreService;
	
	@ResponseBody
	@RequestMapping(value="/list")
	public String getScoreList(Integer curr, Integer nums, ScoreVo scoreVo) {
		System.out.println(scoreVo);
		Pagination<ScoreVo> page = new Pagination<ScoreVo>();
		page.setTotalItemsCount(scoreService.getTotalItemsCount(scoreVo));
		page.setPageSize(nums);
		page.setPageNum(curr);
		
		List<ScoreVo> list = scoreService.getScoreList(page, scoreVo);
		String jsonStr = StrUtil.RETURN_JONS_PRE_STR
				+ page.getTotalItemsCount()
				+ StrUtil.RETURN_JONS_MID_STR
				+ JSON.toJSONString(list)
				+ StrUtil.RETURN_JONS_END_STR;
		System.out.println(jsonStr);
		return jsonStr;
	}
	
	@ResponseBody
	@RequestMapping("/export")
	public void export(HttpServletRequest request, HttpServletResponse response, ScoreVo scoreVo)
			throws ClassNotFoundException, IntrospectionException,
			IllegalAccessException, ParseException, InvocationTargetException {
			
		response.reset(); // 清除buffer缓存
		// 设置文件名
		response.setHeader("Content-Disposition", "attachment;filename="
				+ System.currentTimeMillis() + ".xls");
		response.setContentType("application/vnd.ms-excel;charset=UTF-8");
		response.setHeader("Pragma", "no-cache");
		response.setHeader("Cache-Control", "no-cache");
		response.setDateHeader("Expires", 0);
		XSSFWorkbook workbook = null;
		// 导出Excel对象
		workbook = scoreService.exportExcelInfo(scoreVo);
		OutputStream output;
		try {
			output = response.getOutputStream();
			BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
			bufferedOutPut.flush();
			workbook.write(bufferedOutPut);
			bufferedOutPut.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * 学生查成绩列表
	 * @param curr
	 * @param nums
	 * @param searchKey
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/stuScore")
	public String getScoreList(@RequestParam(defaultValue="0")int curr,
			@RequestParam(defaultValue="20")int nums,
			HttpSession session, Integer result) {
		Student stu = (Student) session.getAttribute(StrUtil.USER);
		
		Pagination<Course> page = new Pagination<Course>();
		
		page.setTotalItemsCount(scoreService.getTotalItemsCount(stu.getId(), result));
		page.setPageSize(nums);
		page.setPageNum(curr);
		
		List<Course> list = scoreService.getCourseList(page, stu.getId(), result);
		String jsonStr = StrUtil.RETURN_JONS_PRE_STR
				+ page.getTotalItemsCount()
				+ StrUtil.RETURN_JONS_MID_STR
				+ JSON.toJSONString(list)
				+ StrUtil.RETURN_JONS_END_STR;
		System.out.println(jsonStr);
		return jsonStr;
	}
	
	
	/**
	 * 学生选课
	 * @param session
	 * @param id
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/choiceCourse")
	public String choiceCourse(HttpSession session,
			@RequestParam(defaultValue="")Integer id) {
		if (id != null) {
			Student s = (Student) session.getAttribute(StrUtil.USER);
			Score score = new Score();
			score.setsId(s.getId());
			score.setcId(id);
			int res = scoreService.choiceCourse(score);
			if (res > 0) return StrUtil.RESULT_TRUE;
			else return StrUtil.RESULT_FALSE;
		}
		return "参数错误!";
	}
	
	
	/**
	 * 学生取消选课
	 * @param id
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/delete")
	public String deleteCourse(@RequestParam(defaultValue="")Integer id, HttpSession session) {
		Student stu = (Student) session.getAttribute(StrUtil.USER);
		Score s = new Score();
		s.setcId(id);
		s.setsId(stu.getId());
		if (id != null) {
			int res = scoreService.deleteScore(s);
			if (res > 0) return StrUtil.RESULT_TRUE;
			else return StrUtil.RESULT_FALSE;
		}
		return "参数错误!";
	}
	
	/**
	 * 评分
	 * @param score
	 * @return
	 */
	@ResponseBody
	@RequestMapping(value="/update")
	public String updateScore(Score score) {
		int res = scoreService.updateScore(score);
		if (res > 0) return StrUtil.RESULT_TRUE;
		else return StrUtil.RESULT_FALSE;
	}
	
	@ResponseBody
	@RequestMapping(value="/updateList")
	public String updateScoreList(String scoreListStr) {
		List<Score> scoreList = JSON.parseArray(scoreListStr, Score.class);
		System.out.println(scoreList);
		int res = scoreService.updateScore(scoreList);
		if (res > 0) return StrUtil.RESULT_TRUE;
		else return StrUtil.RESULT_FALSE;
	}
}

登录管理控制层:

@Controller
@RequestMapping(value="/login")
public class LoginController {
	
	@Autowired
	AuthService authService;
	
	@Autowired
	AdminService adminServiceImpl;
	
	@Autowired
	TeacherService teacherServiceImpl;
	
	@Autowired
	StudentService studentServiceImpl;
	
	@RequestMapping(value="/loginPage")
	public ModelAndView toLoginPage() {
		return new ModelAndView("login");
	}
	
	@ResponseBody
	@RequestMapping(value="/doLogin")
	public String doLogin(@RequestParam(defaultValue="") String username,
			@RequestParam(defaultValue="") String password,
			@RequestParam(defaultValue="0") int userType,
			@RequestParam(defaultValue="") String verifyCode, HttpSession session) {
		
		//比较验证码
		String sessionVerifyCode = (String) session.getAttribute(StrUtil.VERIFY_CODE);
		if (sessionVerifyCode == null || !sessionVerifyCode.equals(verifyCode.toUpperCase()) ) {
			return StrUtil.CODE_ERROR;
		}
		
		Login loginUser = null;
		if (userType == 1) {
			loginUser = (Login) adminServiceImpl;
		} else if(userType == 2) {
			loginUser = (Login) teacherServiceImpl;
		} else if(userType == 3) {
			loginUser = (Login) studentServiceImpl;
		}
		User user = loginUser.loginValidate(username, password.toUpperCase());//获得验证后user对象
		
		if (user != null) {
			
			//List<Auth> menuList = authService.getMenuList(user.getUserType());
			List<Auth> urlList = authService.getUrlList(user.getUserType());
			
			user.setUrlList(urlList);
			//user.setMenuList(menuList);
			
			session.setAttribute(StrUtil.USER, user);
			return JSON.toJSONString(user);
		}
		
		return StrUtil.RESULT_FALSE;
	}
	
	@RequestMapping(value="/out")
	public ModelAndView loginOut(HttpSession session) {
		session.invalidate();//销毁sessions
		//请求重定向到主页(login页)
		return new ModelAndView("redirect:/");
	}
	
	@RequestMapping(value="/getVerifyCode")
	public void getVerifyCode(HttpServletResponse response, HttpSession session) {
		ByteArrayOutputStream output = new ByteArrayOutputStream();
		session.setAttribute("verifyCode", drawCodeImg(output));
		try {
			ServletOutputStream out = response.getOutputStream();
			output.writeTo(out);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	/**
	 * 绘出验证码
	 * @param output
	 * @return
	 */
	private String drawCodeImg(ByteArrayOutputStream output) {
		String code = "";
		for (int i = 0; i < 4; i++) {
			code += randomChar();
		}
		
		int width = 70;
		int height = 36;
		BufferedImage bImage = new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR);
		Font font = new Font("Times New Roman", Font.PLAIN, 20);
		Graphics2D graphics = bImage.createGraphics();
		graphics.setFont(font);
		graphics.setColor(new Color(66,2,82));
		graphics.setBackground(new Color(226,226,240));
		graphics.clearRect(0, 0, width, height);
		FontRenderContext context = graphics.getFontRenderContext();
		Rectangle2D bounds = font.getStringBounds(code, context);
		double x = (width - bounds.getWidth()) / 2;
        double y = (height - bounds.getHeight()) / 2;
        double ascent = bounds.getY();
        double baseY = y - ascent;
        graphics.drawString(code, (int) x, (int) baseY);
        graphics.dispose();
        try {
			ImageIO.write(bImage, "jpg", output);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return code;
	}

	/**
	 * 返回一个随机字符
	 * @return
	 */
	private char randomChar() {
		Random r = new Random();
		String str = "ABCDEFGHJKLMNPRSTUVWXYZ0123456789";
		return str.charAt(r.nextInt(str.length()));
	}
}

角色管理控制层: 

@Controller
@RequestMapping(value="/auth")
public class AuthController {
	
	@Autowired
	AuthService authService;
	
	@ResponseBody
	@RequestMapping(value="/list")
	public String getAuthList(@RequestParam(defaultValue="0")int curr,@RequestParam(defaultValue="10")int nums,
			@RequestParam(defaultValue="")String searchKey) {
		Pagination<Auth> page = new Pagination<Auth>();
		page.setTotalItemsCount(authService.getTotalItemsCount(searchKey));
		page.setPageSize(nums);
		page.setPageNum(curr);
		List<Auth> list = authService.getAuthList(page, searchKey);
		
		String jsonStr = StrUtil.RETURN_JONS_PRE_STR + page.getTotalItemsCount() 
				+ StrUtil.RETURN_JONS_MID_STR
				+ JSON.toJSONString(list) + StrUtil.RETURN_JONS_END_STR;
		
		return jsonStr;
	}
	
	@ResponseBody
	@RequestMapping(value="/setting")
	public String setting(Auth auth, String type, Byte val) {
		if ("teacherAuth".equals(type)) {
			auth.setTeacherAuth(val);
		} else {
			auth.setStudentAuth(val);
		}
		System.out.println(auth.toString());
		if (authService.update(auth) > 0) return StrUtil.RESULT_TRUE;
		return "操作失败!";
	}
	
	
}

源码获取:俺的博客首页 "资源" 里下载!

  • 9
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

qq1334611189

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

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

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

打赏作者

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

抵扣说明:

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

余额充值