首页 > 作文

基于Java实现考试管理系统

更新时间:2023-04-04 05:07:24 阅读: 评论:0

目录
项目简述项目运行项目技术效果图展示主要代码

项目简述

本系统功能包括:

支持单选题、多选题、判断题支持学生(student)、教师(teacher)、管理员(admin)三种角色学生:参加考试和查看我的考试教师:学生的所有权限+创建/编辑题目+创建/编辑考试管理员:教师的所有权限+管理用户。

项目运行

环境配置:

jdk1.8 + tomcat8.5 + mysql + hbuilderx(webstorm也行)+ eclispe(intellij idea,eclispe,myeclispe,sts都支持)。

项目北京it培训机构技术

springboot + maven + jpa+ vue 等等组成,b/s模式 + maven管理等等。

效果图展示

主要代码

登录控制层:

@restcontrollerpublic class logincontroller {     @resource(name = "loginrvice")    private iloginrvice loginrvice;     /**     * 用户登录调用 在登陆成功生成两个token 同时返回各自首页     * * 学生 student/student     * * 老师 teacher/teacher     * * 管理员 admin/admin     */    @requestmapping(value = "/login/login", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    public result<token> login(httprequest requ跆拳道特技表演est) {        return loginrvice.login(request.getstring("login_name"), request.getstring("pwd"));    }     /**     * 登录检查     */    @requestmapping(value = "/login/check", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    public result<toke火星文网名n> check() {        return new result<>();    }     /**     * token 续约     */    @requestmapping(value = "/login/refresh", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    public result<token> refresh(httprequest request) {        string refreshtoken = request.getstring("refresh_token2017立春时间");        string urlid = request.getstring("url_id");        token token = tokencache.getinstance().get(urlid);        if(token == null){            exceptionhelper.error(errorcode.error_code_0003);        }        try {            claims claims = tokenutils.partoken(refreshtoken);            if (stringutils.isnotempty((string.valueof(claims.getordefault("student_id", ""))))) {                claims.put("student_id", ssioncontext.get("student_id"));            }            if (stringutils.isnotempty((string.valueof(claims.getordefault("teacher_id", ""))))) {                claims.put("teacher_id", ssioncontext.get("teacher_id"));            }            if (stringutils.isnotempty((string.valueof(claims.getordefault("login_name", ""))))) {                claims.put("login_name", ssioncontext.get("login_name"));            }            claims.put("name", claims.get("name"));            token.ttoken(tokenutils.createtoken(claims, tokenutils.expiretime));            token.trefreshtoken(tokenutils.createtoken(claims, tokenutils.long_expiretime));            tokencache.getinstance().add(token);        } catch (exception e) {            exceptionhelper.error(errorcode.error_code_0003);        }        return new result<>(token);    }     /**     * 退出系统     */    @requestmapping(value = "/login/exit", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    public result<token> exit(httprequest request) {        string urlid = request.getstring("url_id");        if (stringutils.isnotempty(urlid)) {            tokencache.getinstance().remove(urlid);        }        return new result<>();    }}

统一管理学生 教师 管理员信息:

  /** * 统一管理学生 教师 管理员信息 */@restcontrollerpublic class urcontroller {     @resource(name = "urrvice")    private iurrvice urrvice;     /**     * 查询用户信息     * 先判断用户类型 在查询用户信息     */    @requestmapping(value = "/ur/qryurinfo", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    public result<ur> qryurinfo() {        return urrvice.qryurinfo();    }     /**     * 更新用户信息     */    @requestmapping(value = "/ur/update", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    public result<ur> update(httprequest request) {        ur ur = new ur();        ur.turid(request.getstring("ur_id"));        ur.tname(request.getstring("name"));        ur.tx(request.getinteger("x"));        ur.ttype(ur.urtype.get(request.getinteger("type")));        return urrvice.update(ur, imageutil.stringtobytes(request.getstring("ur_image")));    }     /**     * 更新用户密码     */    @requestmapping(value = "/ur/updatepwd", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    public result<ur> updatepwd(httprequest request) {        return urrvice.updatepwd(request.getstring("old_pwd"), request.getstring("pwd"));    }}

学生管理控制器:

/** * 学生控制器 */@restcontrollerpublic class studentcontroller {     @resource(name = "studentrvice")    private istudentrvice studentrvice;     /**     * 管理员 查询学生列表     */    @requestmapping(value = "/student/qrypage", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    @roleannotation(types = {roleenum.admin})    public listresult<student> qrypage(httprequest request) {        map<string, object> param = new hashmap<>();        int pageno = request.containskey("page_no") ? request.getinteger("page_no") : 1;        int pagesize = request.containskey("page_size") ? request.getinteger("page_size") : 20;        if (request.containskey("student_id")) {            param.put("student_id", request.getstring("student_id"));        }        if (request.containskey("name")) {            param.put("name", request.getstring("name"));        }        return studentrvice.qrypage(param, pageno, pagesize);    }     @requestmapping(value = "/student/add", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    @roleannotation(types = {roleenum.admin})    public result<student> inrt(httprequest request) {        student student = new student();        student.tstudentid(request.getstring("student_id"));        student.tname(request.getstring("student_name"));        student.tpwd(request.getstring("student_id"));        student.tx(request.getinteger("x"));        student.tclassid(request.getstring("class_id"));        student.tupdatetime(new date());        return studentrvice.inrt(student, imageutil.stringtobytes(request.getstring("student_image")));    }     @requestmapping(value = "/student/update", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    @roleannotation(types = {roleenum.admin})    public result<student> update(httprequest request) {        student student = new student();        student.tstudentid(request.getstring("student_id"));        student.tname(request.getstring("student_name"));        student.tpwd(request.getstring("student_id"));        student.tx(request.getinteger("x"));        student.tclassid(request.getstring("class_id"));        student.tupdatetime(new date());        return studentrvice.update(student, imageutil.stringtobytes(request.getstring("student_image")));    }     @requestmapping(value = "/student/del", method = requestmethod.post, produces = {"application/json;chart=utf-8"})    @roleannotation(types = {roleenum.admin})    public result<student> del(httprequest request) {        list<string> studentidl查字数ist = new arraylist<>();        jsonarray array = request.getjsonarray("student_id_list");        for (int i = 0; i < array.size(); i++) {            studentidlist.add(array.getstring(i));        }        return studentrvice.del(studentidlist);    }  }

到此这篇关于基于java实现考试管理系统的文章就介绍到这了,更多相关java考试管理系统内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!

本文发布于:2023-04-04 05:07:22,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/zuowen/de4ec77ac5753f184e06cc84916ac096.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

本文word下载地址:基于Java实现考试管理系统.doc

本文 PDF 下载地址:基于Java实现考试管理系统.pdf

标签:学生   管理员   项目   教师
相关文章
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图