微信小程序|SSM实现培训机构管理系统
Posted 编程指南针
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了微信小程序|SSM实现培训机构管理系统相关的知识,希望对你有一定的参考价值。
作者主页:编程指南针
作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师
主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助
文末获取源码
项目编号:BS-XCX-010
一,项目简介
本系统 主要实现一个针对培训机构进行宣传和信息管理的信息化管理系统,系统一是对内部的学生选课及成绩管理,一是通过小程序对外进行宣传 并提供了小程序管理后台数据的功能。前端使用微信小程序开发实现,主要实现一些静态数据的展示和宣传功能,后台主要使用SSM框架开发实现完成对教师、学生和课程的基本信息管理。主要功能如下
微信小程序端:
1.小程序端管理员实现对信息模块的管理,包含课程、讲师、学员三类模块。
2.小程序端用户实现各类模块内容的浏览。
Web后台管理端:
1.Web端管理员实现对信息模块的管理;
2.Web端讲师实现对培训机构学员课程成绩打分等功能;
3.Web端学员实现对培训机构课程的报名、退选以及课程成绩查看等功能;
二,环境介绍
语言环境:Java: jdk1.8
数据库:mysql: mysql5.7
应用服务器:Tomcat: tomcat8.5.31
开发工具:IDEA或eclipse
相关技术:
- 微信小程序(js、css前端基础):前端小程序页面;
- SSM框架(Spring+SpringMVC+Mybatis):微信小程序界面需要调用的接口以及后台的管理系统;
- Maven:项目管理必备的技术;
- Shiro框架:保证系统安全的框架;
- Bootstrap前端框架:Web后台管理端的后台界面;
三,系统展示
后台管理功能的展示
管理员
课程管理
学员管理
讲师管理
学生登陆
讲师登陆
前端小程序端演示
管理员登陆
学生登陆:主要进行信息的宣传展示
信息资讯
查看课程
个人中心
四,核心代码展示
package com.system.controller;
import com.system.exception.CustomException;
import com.system.po.*;
import com.system.service.*;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.annotation.Resource;
import java.util.List;
@Controller
@RequestMapping("/admin")
public class AdminController
@Resource(name = "studentServiceImpl")
private StudentService studentService;
@Resource(name = "teacherServiceImpl")
private TeacherService teacherService;
@Resource(name = "courseServiceImpl")
private CourseService courseService;
@Resource(name = "collegeServiceImpl")
private CollegeService collegeService;
@Resource(name = "userloginServiceImpl")
private UserloginService userloginService;
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<学生操作>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
@RequestMapping("/showStudent")
public String showStudent(Model model, Integer page) throws Exception
List<StudentCustom> list = null;
//页码对象
PagingVO pagingVO = new PagingVO();
//设置总页数
pagingVO.setTotalCount(this.studentService.getCountStudent());
if (page == null || page == 0)
pagingVO.setToPageNo(1);
list = studentService.findByPaging(1);
else
pagingVO.setToPageNo(page);
list = studentService.findByPaging(page);
/* if (page != null && page.intValue() != 0)
pagingVO.setToPageNo(page);
list = this.studentService.findByPaging(1);
else
pagingVO.setToPageNo(Integer.valueOf(1));
list = this.studentService.findByPaging(Integer.valueOf(1));
*/
model.addAttribute("studentList", list);
model.addAttribute("pagingVO", pagingVO);
return "/admin/showStudent";
// 添加学生信息页面显示
@RequestMapping(value = "/addStudent", method = RequestMethod.GET)
public String addStudentUI(Model model) throws Exception
List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list);
return "/admin/addStudent";
// 添加学生信息操作
@RequestMapping(value = "/addStudent", method = RequestMethod.POST)
public String addStudent(StudentCustom studentCustom, Model model) throws Exception
Boolean result = studentService.save(studentCustom);
if (!result)
model.addAttribute("message", "学号重复");
return "error";
//添加成功后,也添加到登录表
Userlogin userlogin = new Userlogin();
userlogin.setUsername(studentCustom.getUserid().toString());
userlogin.setPassword("123");
userlogin.setRole(2);
userloginService.save(userlogin);
//重定向
return "redirect:/admin/showStudent";
// 修改学生信息页面显示
@RequestMapping(value = "/editStudent", method = RequestMethod.GET)
public String editStudentUI(Integer id, Model model) throws Exception
if (id == null)
//加入没有带学生id就进来的话就返回学生显示页面
return "redirect:/admin/showStudent";
StudentCustom studentCustom = studentService.findById(id);
if (studentCustom == null)
throw new CustomException("未找到该名学生");
List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list);
model.addAttribute("student", studentCustom);
return "/admin/editStudent";
// 修改学生信息处理
@RequestMapping(value = "/editStudent", method = RequestMethod.POST)
public String editStudent(StudentCustom studentCustom) throws Exception
studentService.updataById(studentCustom.getUserid(), studentCustom);
//重定向
return "redirect:/admin/showStudent";
// 删除学生
@RequestMapping(value = "/removeStudent", method = RequestMethod.GET )
private String removeStudent(Integer id) throws Exception
if (id == null)
//加入没有带学生id就进来的话就返回学生显示页面
return "/admin/showStudent";
studentService.removeById(id);
userloginService.removeByName(id.toString());
return "redirect:/admin/showStudent";
// 搜索学生
@RequestMapping(value = "selectStudent", method = RequestMethod.POST)
private String selectStudent(String findByName, Model model) throws Exception
List<StudentCustom> list = studentService.findByName(findByName);
model.addAttribute("studentList", list);
return "/admin/showStudent";
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<教师操作>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
// 教师页面显示
@RequestMapping("/showTeacher")
public String showTeacher(Model model, Integer page) throws Exception
List<TeacherCustom> list = null;
PagingVO pagingVO = new PagingVO();
pagingVO.setTotalCount(this.teacherService.getCountTeacher());
if (page != null && page.intValue() != 0)
pagingVO.setToPageNo(page);
list = this.teacherService.findByPaging(page);
else
pagingVO.setToPageNo(Integer.valueOf(1));
list = this.teacherService.findByPaging(Integer.valueOf(1));
model.addAttribute("teacherList", list);
model.addAttribute("pagingVO", pagingVO);
return "/admin/showTeacher";
// 添加教师信息
@RequestMapping(value = "/addTeacher", method = RequestMethod.GET)
public String addTeacherUI(Model model) throws Exception
List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list);
return "/admin/addTeacher";
// 添加教师信息处理
@RequestMapping(value = "/addTeacher", method = RequestMethod.POST)
public String addTeacher(TeacherCustom teacherCustom, Model model) throws Exception
Boolean result = teacherService.save(teacherCustom);
if (!result)
model.addAttribute("message", "工号重复");
return "/error";
//添加成功后,也添加到登录表
Userlogin userlogin = new Userlogin();
userlogin.setUsername(teacherCustom.getUserid().toString());
userlogin.setPassword("123");
userlogin.setRole(1);
userloginService.save(userlogin);
//重定向
return "redirect:/admin/showTeacher";
// 修改教师信息页面显示
@RequestMapping(value = "/editTeacher", method = RequestMethod.GET)
public String editTeacherUI(Integer id, Model model) throws Exception
if (id == null)
return "redirect:/admin/showTeacher";
TeacherCustom teacherCustom = teacherService.findById(id);
if (teacherCustom == null)
throw new CustomException("未找到该名学生");
List<College> list = collegeService.finAll();
model.addAttribute("collegeList", list);
model.addAttribute("teacher", teacherCustom);
return "/admin/editTeacher";
// 修改教师信息页面处理
@RequestMapping(value = "/editTeacher", method = RequestMethod.POST)
public String editTeacher(TeacherCustom teacherCustom) throws Exception
teacherService.updateById(teacherCustom.getUserid(), teacherCustom);
//重定向
return "redirect:/admin/showTeacher";
//删除教师
@RequestMapping("/removeTeacher")
public String removeTeacher(Integer id) throws Exception
if (id == null)
//加入没有带教师id就进来的话就返回教师显示页面
return "/admin/showTeacher";
teacherService.removeById(id);
userloginService.removeByName(id.toString());
return "redirect:/admin/showTeacher";
//搜索教师
@RequestMapping(value = "selectTeacher", method = RequestMethod.POST)
private String selectTeacher(String findByName, Model model) throws Exception
List<TeacherCustom> list = teacherService.findByName(findByName);
model.addAttribute("teacherList", list);
return "/admin/showTeacher";
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<课程操作>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
// 课程信息显示
@RequestMapping("/showCourse")
public String showCourse(Model model, Integer page) throws Exception
List<CourseCustom> list = null;
//页码对象
PagingVO pagingVO = new PagingVO();
//设置总页数
pagingVO.setTotalCount(courseService.getCountCourse());
if (page == null || page == 0)
pagingVO.setToPageNo(1);
list = courseService.findByPaging(1);
else
pagingVO.setToPageNo(page);
list = courseService.findByPaging(page);
model.addAttribute("courseList", list);
model.addAttribute("pagingVO", pagingVO);
return "/admin/showCourse";
//添加课程
@RequestMapping(value = "/addCourse", method = RequestMethod.GET)
public String addCourseUI(Model model) throws Exception
List<TeacherCustom> list = teacherService.findAll();
List<College> collegeList = collegeService.finAll();
model.addAttribute("collegeList", collegeList);
model.addAttribute("teacherList", list);
return "/admin/addCourse";
// 添加课程信息处理
@RequestMapping(value = "/addCourse", method = RequestMethod.POST)
public String addCourse(CourseCustom courseCustom, Model model) throws Exception
Boolean result = courseService.save(courseCustom);
if (!result)
model.addAttribute("message", "课程号重复");
return "/error";
//重定向
return "redirect:/admin/showCourse";
// 修改教师信息页面显示
@RequestMapping(value = "/editCourse", method = RequestMethod.GET)
public String editCourseUI(Integer id, Model model) throws Exception
if (id == null)
return "redirect:/admin/showCourse";
CourseCustom courseCustom = courseService.findById(id);
if (courseCustom == null)
throw new CustomException("未找到该课程");
List<TeacherCustom> list = teacherService.findAll();
List<College> collegeList = collegeService.finAll();
model.addAttribute("teacherList", list);
model.addAttribute("collegeList", collegeList);
model.addAttribute("course", courseCustom);
return "/admin/editCourse";
// 修改教师信息页面处理
@RequestMapping(value = "/editCourse", method = RequestMethod.POST)
public String editCourse(CourseCustom courseCustom) throws Exception
courseService.updateById(courseCustom.getCourseid(), courseCustom);
//重定向
return "redirect:/admin/showCourse";
// 删除课程信息
@RequestMapping("/removeCourse")
public String removeCourse(Integer id) throws Exception
if (id == null)
//加入没有带教师id就进来的话就返回教师显示页面
throw new CustomException("查询该课程失败");
courseService.removeById(id);
return "redirect:/admin/showCourse";
//搜索课程
@RequestMapping(value = "selectCourse", method = RequestMethod.POST)
private String selectCourse(String findByName, Model model) throws Exception
List<CourseCustom> list = courseService.findByName(findByName);
model.addAttribute("courseList", list);
return "/admin/showCourse";
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<其他操作>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
// 普通用户账号密码重置
@RequestMapping("/userPasswordRest")
public String userPasswordRestUI() throws Exception
return "/admin/userPasswordRest";
// 普通用户账号密码重置处理
@RequestMapping(value = "/userPasswordRest", method = RequestMethod.POST)
public String userPasswordRest(Userlogin userlogin) throws Exception
Userlogin u = userloginService.findByName(userlogin.getUsername());
if (u != null)
if (u.getRole() == 0)
throw new CustomException("该账户为管理员账户,没法修改");
u.setPassword(userlogin.getPassword());
userloginService.updateByName(userlogin.getUsername(), u);
else
throw new CustomException("没找到该用户");
return "/admin/userPasswordRest";
// 本账户密码重置
@RequestMapping("/passwordRest")
public String passwordRestUI() throws Exception
return "/admin/passwordRest";
package com.system.controller;
import com.system.po.Userlogin;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.Map;
/**
* 包含Web端以及微信小程序端登录
*/
@Controller
public class LoginController
//登录跳转
@RequestMapping(value = "/login", method = RequestMethod.GET)
public String loginUI() throws Exception
return "/login";
@RequestMapping(value="/logout",method = RequestMethod.GET)
public String logout() throws Exception
return "/login";
@RequestMapping(value = "/wxlogin", method = RequestMethod.POST,RequestMethod.GET)
@ResponseBody
public Map<String,String> wxlogin(Userlogin userlogin, Model model) throws Exception
//Shiro实现登录
Map<String,String> map = new HashMap<String, String>();
UsernamePasswordToken token = new UsernamePasswordToken(userlogin.getUsername(),
userlogin.getPassword());
//Subject:项目,通过Shiro保护的项目一个抽象概念
//通过令牌(token)与项目(subject)的登陆(login)关系,Shiro保证了项目整体的安全
//获取Subject单例对象
Subject subject = SecurityUtils.getSubject();
//如果获取不到用户名就是登录失败,但登录失败的话,会直接抛出异常
//登录
subject.login(token);
if (subject.hasRole("admin"))
map.put("role","admin");
map.put("username",userlogin.getUsername());
else if (subject.hasRole("teacher"))
map.put("role","teacher");
map.put("username",userlogin.getUsername());
else if (subject.hasRole("student"))
map.put("role","student");
map.put("username",userlogin.getUsername());
return map;
//登录表单处理
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(Userlogin userlogin) throws Exception
//Shiro实现登录
UsernamePasswordToken token = new UsernamePasswordToken(userlogin.getUsername(),
userlogin.getPassword());
Subject subject = SecurityUtils.getSubject();
//如果获取不到用户名就是登录失败,但登录失败的话,会直接抛出异常
//登录
subject.login(token);
if (subject.hasRole("admin"))
return "redirect:/admin/showStudent";
else if (subject.hasRole("teacher"))
return "redirect:/teacher/showCourse";
else if (subject.hasRole("student"))
return "redirect:/student/showCourse";
return "/login";
五,项目总结
本项目主要为培训机构的内部进行信息化的管理,并对培训机构进行相应的宣传,主要通过小程序+后台管理服务模块开发实现,通过前后端分离的方式来进行。
以上是关于微信小程序|SSM实现培训机构管理系统的主要内容,如果未能解决你的问题,请参考以下文章
计算机毕业设计ssm+vue基本微信小程序的健康管理系统 uniapp 小程序
ssm基于微信小程序的高校课堂教学管理系统--(ssm+uinapp+Mysql)