SSM+layui实现学籍管理系统

本文介绍了使用Java、Spring MVC、Mybatis和MySQL等技术开发的一个教育管理系统。系统涵盖学生、教师和管理员三大角色的功能,包括登录、个人信息管理、成绩查询和课程管理等。此外,还展示了登录功能的代码实现,并提供了系统演示链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.技术介绍
java+springmvc+spring+Mybatis+mysql+layui+jsp
开发工具:eclipse或IDEA
2.主要功能说明:
学生:
登录、查看基本资料、修改密码、退出登录、查看选课、查看公告、成绩查询
教师:
登录、查看基本资料、修改密码、退出登录、成绩管理、学生信息查询
管理员:
专业管理、班级管理、学生管理、老师管理、公告管理、课程管理、开课管理、用户管理
3.部分代码展示:
登录

public class LoginController {

    @Autowired
    private UserService userService;
    @Autowired
    private TeacherService teacherService;
    @Autowired
    private StudentService studentService;

    //跳转登录页面
    @GetMapping("/login")
    public String login() {
        return "login";
    }

    //登录操作
    @PostMapping("/login")
    @ResponseBody
    public Map<String, Object> login(String userName, String password, String captcha, String type, HttpSession session) {
        //判断用户名、密码、用户类型、验证码是否为空
        if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(password) || StringUtils.isEmpty(captcha) || StringUtils.isEmpty(type)) {
            return MapControl.getInstance().error("用户名或密码不能为空").getMap();
        }
        //获取系统生成的验证码
        String _captcha = (String) session.getAttribute("captcha");
        //先判断验证码是否正确
        if (!(captcha.toLowerCase()).equals(_captcha.toLowerCase())) {
            //验证码错误
            return MapControl.getInstance().error("验证码错误").getMap();
        }

        //判断用户类型
        if ("1".equals(type)) { //管理员验证登录
            User user = userService.login(userName, MD5Utils.getMD5(password)); //对密码进行加密处理,因为数据库中存储的是加密后的密码
            if (user != null) {
                session.setAttribute("user", user);
                session.setAttribute("type", 1);
                return MapControl.getInstance().success().add("data", user).getMap();
            } else {
                return MapControl.getInstance().error("用户名或密码错误").getMap();
            }
        }
        if ("2".equals(type)) { //老师验证登录
            Teacher teacher = teacherService.login(userName, MD5Utils.getMD5(password));
            if (teacher != null) {
                session.setAttribute("user", teacher);
                session.setAttribute("type", "2");
                return MapControl.getInstance().success().add("data", teacher).getMap();
            } else {
                return MapControl.getInstance().error("用户名或密码错误").getMap();
            }
        }
        if ("3".equals(type)) { //学生验证登录
            Student student = studentService.login(userName, MD5Utils.getMD5(password));
            if (student != null) {
                session.setAttribute("user", student);
                session.setAttribute("type", "3");
                return MapControl.getInstance().success().add("data", student).getMap();
            } else {
                return MapControl.getInstance().error("用户名或密码错误").getMap();
            }
        }
        return MapControl.getInstance().getMap();
    }

}```
4.系统演示地址:
链接:https://pan.baidu.com/s/1o7ywp3o2rkaqhsPbRMwxXQ 
提取码:dn4r
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值