文件包含项目简单介绍、环境配置参数说明文档及全部程序源码
有想要源码和相关文档的见最下方博主联系方式。
网络考试系统主要用于实现高校在线考试,基本功能包括:自动组卷、试卷发布、试卷批阅、试卷成绩统计等。本系统结构如下:
(1)学生端:
登录模块:登录功能;
网络考试模块:可参加考试,并查看考试结果,提交试卷后老师允许的情况下查看错题;
(2)超级管理员端:
登录模块:实现管理员登录功能;
用户管理模块:实现用户信息的增加、修改、查看功能;
角色权限管理模块:实现角色的增加、修改、查看功能;
试卷管理模块:实现试卷信息的增加、修改、查看功能;
试题管理模块:实现试题信息的增加、修改、查看功能;
(3)试题管理员端(老师):
试卷管理模块:实现试卷信息的增加、修改、查看功能;
试题管理模块:实现试题信息的增加、修改、查看功能;
package cn.itbaizhan.tyut.exam.model;
public class SysFunction {
public Integer getRr() {
return rr;
}
public void setRr(Integer rr) {
this.rr = rr;
}
public String getFunpname() {
return funpname;
}
public void setFunpname(String funpname) {
this.funpname = funpname;
}
/**
* 系统功能ID
*/
private Integer funid;
/**
* 系统功能名称
*/
private String funname;
/**
* 功能地址
*/
private String funurl;
/**
* 父功能ID
*/
private Integer funpid;
/**
* 父功能名称
*/
private String funpname;
/**
* 功能状态
*/
private Integer funstate;
private Integer rr;
public Integer getFunid() {
return funid;
}
public void setFunid(Integer funid) {
this.funid = funid;
}
public String getFunname() {
return funname;
}
public void setFunname(String funname) {
this.funname = funname;
}
public String getFunurl() {
return funurl;
}
public void setFunurl(String funurl) {
this.funurl = funurl;
}
public Integer getFunpid() {
return funpid;
}
public void setFunpid(Integer funpid) {
this.funpid = funpid;
}
public Integer getFunstate() {
return funstate;
}
public void setFunstate(Integer funstate) {
this.funstate = funstate;
}
}
package cn.itbaizhan.tyut.exam.sys.dao.impl;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.dbutils.DbUtils;
import org.apache.commons.dbutils.QueryRunner;
import cn.itbaizhan.tyut.exam.common.DBUnitHelper;
import cn.itbaizhan.tyut.exam.common.PageControl;
import cn.itbaizhan.tyut.exam.common.Pager;
import cn.itbaizhan.tyut.exam.model.SysFunction;
import cn.itbaizhan.tyut.exam.model.Sysrole;
import cn.itbaizhan.tyut.exam.sys.dao.interfaces.IRoleDao;
public class RoleDao implements IRoleDao {
public Pager<Sysrole> list(Sysrole role, PageControl pc) {
String sql = "SELECT ROLEID,ROLENAME,ROLEDESC,ROLESTATE FROM " +
" SYSROLE WHERE ROLEID>-2 ";
Pager<Sysrole> pager = null;
String roleid="roleid";
if(role.getRolename()!=null && !role.getRolename().equals(""))
{
sql += " AND ROLENAME=?";
pager = DBUnitHelper.execlist(sql, pc, Sysrole.class,roleid, role.getRolename());
}else{
pager = DBUnitHelper.execlist(sql, pc, Sysrole.class,roleid, null);
}
return pager;
}
public Integer add(Sysrole role) {
String sql = "INSERT INTO SYSROLE(ROLENAME,ROLEDESC,ROLESTATE) " +
"VALUES (?,?,?)";
return DBUnitHelper.executeUpdate(sql, role.getRolename(),role.getRoledesc(),role.getRolestate());
}
public List<SysFunction> initfunlist(Sysrole role) {
String sql = "select A.funid,A.funname,A.funurl,A.funpid,A.funstate, " +
"(CASE WHEN B.RRID IS NULL THEN '0' ELSE '1' END) AS RR " +
"from sysfunction A " +
"LEFT OUTER JOIN ROLERIGHT B ON A.FUNID=B.FUNID AND B.ROLEID=? " +
"WHERE A.FUNSTATE=1 ";
List<SysFunction> list = DBUnitHelper.executeQuery(sql, SysFunction.class, role.getRoleid());
return list;
}
public Sysrole detail(Sysrole role) {
String sql = "SELECT ROLEID,ROLENAME,ROLEDESC,ROLESTATE FROM " +
" SYSROLE WHERE ROLEID=? ";
List<Sysrole> list = DBUnitHelper.executeQuery(sql, Sysrole.class, role.getRoleid());
return list.get(0);
}
public ArrayList<Sysrole> getALL()
{
String sql = "SELECT ROLEID,ROLENAME,ROLEDESC,ROLESTATE FROM " +
" SYSROLE";
ArrayList<Sysrole> roles=(ArrayList<Sysrole>) DBUnitHelper.executeQuery(sql, Sysrole.class);
return roles;
}
public Integer saveright(String roleid, String[] funids) {
String sql = "DELETE FROM ROLERIGHT WHERE ROLEID="+roleid;
Connection conn = DBUnitHelper.getConn();
Integer rst = 0;
try {
conn.setAutoCommit(false);
QueryRunner rq = new QueryRunner();
int rtn = rq.update(conn, sql);
for(int i=0;i<funids.length;i++){
String sql2 = "INSERT INTO ROLERIGHT (ROLEID,FUNID) VALUES ("+roleid+","+funids[i]+")";
rtn = rq.update(conn,sql2);
if(rtn>0){
continue;
}else{
conn.rollback();
break;
}
}
conn.commit();
rst = 1;
DbUtils.close(conn);
} catch (Exception e) {
try {
conn.rollback();
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
// TODO Auto-generated catch block
e.printStackTrace();
}
return rst;
}
public Integer edit(Sysrole role) {
String sql = "UPDATE SYSROLE SET ROLENAME=?,ROLESTATE=?," +
"ROLEDESC=? WHERE ROLEID=?";
Integer rtn = DBUnitHelper.executeUpdate(sql,role.getRolename(),
role.getRolestate(),role.getRoledesc(),role.getRoleid());
return rtn;
}
}