当前位置:首页 > 杂谈 > 正文内容

基于ssm的教务管理系统(教务系统管理系统设计)

2024-09-20 13:16:57杂谈144

文章末尾附源码

大家好,今天给大家带来的是基于ssm的教务管理系统,整理了大概一周。

1.前后端技术

前端:layui框架+jspjavascript的Echart可视化插件)

后端:spring+springMVC+mybatis+Shiro(权限分配)

2.项目介绍

角色一共有三种:教师+学生+超级管理员(后续也可以自己定义添加或者删除)

主要实现了用户的登录注册,公告的浏览,选课操作,超级管理员可以分配权限,以及对教师和学生的所有操作。不同的管理员对不同信息的管理,教师对课程评分,教师结课等功能。使用Echart加入了可视化数据,进行简单的可视化操作。使用了流加载对通知公告进行显示。

3.运行环境

1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。

2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA;

3.tomcat环境:Tomcat 8.x,9.x版本均可

4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS;

5.是否Maven项目: 是;查看源码目录中是否包含pom.xml;若包含,则为maven项目,否则为非maven项目

6.数据库:MySql 8.0版本;

4.项目部分代码

登陆管理

@Controller @RequestMapping("/easLogin") public class EasLoginController { @Autowired private EasPermissionMapper easPermissionMapper; @RequestMapping("/main") public String main() throws Exception{ return "main"; } @RequestMapping("/success") @ResponseBody public Map<String,Object> success(HttpSession session) throws Exception{ Map<String,Object> map = new HashMap<>(); map.put("code",0); EasUser easUser = (EasUser) SecurityUtils.getSubject().getPrincipal(); session.setAttribute(Constants.LOGIN_USER,easUser); List<EasPermission> list = easPermissionMapper.getPersByUserId(easUser.getId()); session.setAttribute(Constants.LOGIN_USER_PERS,list); return map; } @RequestMapping(value = "/login",method = RequestMethod.GET) public String login() throws Exception{ return "login"; } /** * post方式的login方式什么时候调用? * 身份认证失败的时候会自动调用 * @return * @throws Exception */ @RequestMapping(value = "/login", method = RequestMethod.POST) @ResponseBody public Map<String,Object> login(HttpServletRequest request) throws Exception{ Map<String,Object> map = new HashMap<>(); // System.out.println("认证失败了吧!来我这了吧"); String exceptionName = request.getAttribute("shiroLoginFailure").toString(); if (exceptionName.equals(UnknownAccountException.class.getName())){ map.put("code",1); map.put("msg","用户名不正确"); return map; }else if(exceptionName.equals(IncorrectCredentialsException.class.getName())){ map.put("code",2); map.put("msg","密码不正确"); return map; }else if (exceptionName.equals("randomCodeError")){ map.put("code",3); map.put("msg","验证码不正确"); return map; } return null; } }

角色管理

@Controller @RequestMapping("/easRole") public class EasRoleController { @Autowired private EasRoleMapper easRoleMapper; @RequestMapping("/search") @ResponseBody public List<EasRole> search() throws Exception{ return easRoleMapper.getAll(); } @RequestMapping("/index") @RequiresPermissions("role:query") public String index() throws Exception{ return "system/role/index"; } @RequestMapping("/rolePers") @ResponseBody public List<Long> rolePers(Integer id) throws Exception { return easRoleMapper.getPerIdsByRoleId(id); } @RequestMapping("/assignPers") @ResponseBody public Map<String,Object> assignPers(Integer roleId, String persIds) throws Exception{ Map<String,Object> map = new HashMap<>(); easRoleMapper.deleteRolePermissions(roleId); easRoleMapper.addRolePermissions(roleId,persIds.split(",")); return map; } @RequestMapping("/list") @ResponseBody public Map<String,Object> list(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10") Integer limit, EasRole easRole) throws Exception { Map<String,Object> map = new HashMap<>(); int count = easRoleMapper.getCount(); PageUtil pageUtil = new PageUtil(page,limit); map.put("code",0); map.put("msg",null); map.put("data",easRoleMapper.getList(easRole,pageUtil)); map.put("count",count); return map; } @RequestMapping("/roleForm") public String roleForm() throws Exception { return "system/role/roleForm"; } @RequestMapping(value = "/addRole",method = RequestMethod.POST) @ResponseBody public Map<String, Object> addRole(EasRole easRole) throws Exception{ Map<String,Object> map = new HashMap<>(); // System.out.println("角色名称:"+easRole.getName()); // System.out.println("角色是否可用:"+easRole.getAvailable()); List<EasRole> list = easRoleMapper.findRoleName(easRole.getName()); if (list.size() != 0){ map.put("msg","角色已存在"); map.put("result",false); }else if(easRole.getName().length() <= 0){ map.put("msg","角色名称不能为空"); map.put("result",false); }else{ //课程为null也可以添加 待完善 easRoleMapper.addRole(easRole); map.put("msg","添加成功"); map.put("result",true); } return map; } @RequestMapping("/batchDeleteRole") @ResponseBody @RequiresPermissions("role:delete") public Map<String, Object> batchDeleteRole(Integer[] ids) throws Exception{ Map<String,Object> map = new HashMap<String,Object>(); easRoleMapper.batchDeleteRole(ids); map.put("msg","删除成功"); map.put("result",true); return map; } @RequestMapping(value = "/getRoleView") @ResponseBody public EasRole getRoleView(Integer id) throws Exception { return easRoleMapper.getRoleView(id); } @RequestMapping(value = "/editRole",method = RequestMethod.POST) @ResponseBody public Map<String, Object> editRole(EasRole easRole) throws Exception{ Map<String, Object> map = new HashMap<>(); easRoleMapper.updateBaseCourse(easRole); map.put("result",true); return map; } }

5.项目运行图片

6.源码

平台限制,完整源码私聊回复“SSM教务管理”获取。