毕业设计选题管理系统Word格式文档下载.docx
《毕业设计选题管理系统Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《毕业设计选题管理系统Word格式文档下载.docx(24页珍藏版)》请在冰点文库上搜索。
用户表(user)
字段
类型
备注
userid
Varchar(20)primarykey
用户ID
Pwd
varchar(32)
用户密码
roleId
Int
外键
tname
Varchar(20)
姓名
sex
Varchar(5)
性别
Age
年龄
表1
课题表(task)
taskId
Intprimarykey
课题ID
taskname
varchar(20)
课题名
sflag
int
状态(是否被选)
taskText
varchar(50)
课题内容
表2
选择课题(chosetask)
ctId
intprimarykey
学生选课题id
uId
varchar(10)
表3
上传课题(puttask)
ptId
教师上传课题id
表4
角色表(roleinfo)
角色ID
rolename
角色名
表5
权限表(rightinfo)
rightCode
varchar(20)primarykey
权限
rightParentCode
varchar(30)
父权限
rightType
rightText
RightUrl
varchar(30)
url地址
RightTip
表6
角色权限表(roleright)
rr_id
主键
rr_roleid
外键role表
rr_rightCode
外键rightinfo表
表7
4.典型功能模块的详细设计和实现过程
用户模块
登录功能代码:
publicStringdoLogin()
{
Userinfouu=userService.checkUser(user);
if(uu!
=null)
{
ServletActionContext.getRequest().getSession().setAttribute("
USER"
uu);
introleId=uu.getRoleinfo().getRoleId();
Roleinfor=roleService.getRoleWithRights(roleId);
StringmenuString=buildDTreeMenuString(r);
MENU_STRING"
menuString);
return"
main"
;
}
else
input"
}
publicUserinfocheckUser(Userinfou){
Userinfouu=null;
Stringhql="
fromUserinfowhereuserid=?
andpwd=?
"
Object[]args=newObject[]{u.getUserid(),u.getPwd()};
List<
Userinfo>
list=commonDao.list(hql,args);
if(list!
=null&
&
list.size()>
0)
uu=list.get(0);
returnuu;
publicListlist(Stringhql,Object[]args){
Listlist=this.getHibernateTemplate().find(hql,args);
returnlist;
查询信息功能代码:
publicStringtoList()
SPageBeanspb=newSPageBean();
HttpServletRequestrequest=ServletActionContext.getRequest();
intoffset=0;
if(request.getParameter("
pager.offset"
)==null){
offset=0;
}else{
offset=Integer.parseInt(request.getParameter("
));
intmaxPageItems;
if(request.getAttribute("
maxPageItems"
maxPageItems=5;
maxPageItems=Integer.parseInt(request.getParameter("
spb.setOffset(offset);
spb.setPageSize(maxPageItems);
infoService.getList(spb);
request.setAttribute("
SPB"
spb);
return"
list"
publicvoidgetList(SPageBeanspb){
fromUserinfo"
commonDao.listByPage(hql,spb);
publicvoidlistByPage(Stringhql,SPageBeanspb){
finalStringhql1=hql;
finalSPageBeanspb1=spb;
if(hql!
inttotal=(Integer)this.getHibernateTemplate().execute(newHibernateCallback(){
publicObjectdoInHibernate(Sessionsess)throwsHibernateException,
SQLException{
StringqString="
if(hql1.toLowerCase().indexOf("
select"
)!
=-1)
{
intidx=hql1.toLowerCase().indexOf("
from"
);
qString="
selectcount(*)"
+hql1.substring(idx,hql1.length());
}
else{
+hql1;
QuerycQuery=sess.createQuery(qString);
cQuery.setCacheable(true);
longo=(Long)cQuery.uniqueResult();
intii=(int)o;
returnii;
}
});
spb.setTotal(total);
Listdata=(List)this.getHibernateTemplate().execute(newHibernateCallback(){
Queryquery=sess.createQuery(hql1);
query.setFirstResult(spb1.getOffset());
query.setMaxResults(spb1.getPageSize());
returnquery.list();
spb.setDatas(data);
publicclassSPageBean{
privateintoffset;
privateintpageSize;
privateinttotal;
privateListdatas;
publicintgetTotal(){
returntotal;
publicvoidsetTotal(inttotal){
this.total=total;
publicListgetDatas(){
returndatas;
publicvoidsetDatas(Listdatas){
this.datas=datas;
publicintgetOffset(){
returnoffset;
publicvoidsetOffset(intoffset){
this.offset=offset;
publicintgetPageSize(){
returnpageSize;
publicvoidsetPageSize(intpageSize){
this.pageSize=pageSize;
}
上传课题功能代码:
publicStringtoadd()
add"
publicStringdoadd()
if(taskService.doAdd(task)==true)
SPageBeanspb=newSPageBean();
HttpServletRequestrequest=ServletActionContext.getRequest();
intoffset=0;
if(request.getParameter("
offset=0;
}else{
offset=Integer.parseInt(request.getParameter("
}
intmaxPageItems;
if(request.getAttribute("
maxPageItems=5;
maxPageItems=Integer.parseInt(request.getParameter("
spb.setOffset(offset);
spb.setPageSize(maxPageItems);
taskService.getTaskinfo(spb);
ServletActionContext.getRequest().setAttribute("
SPB1"
publicbooleandoAdd(TaskInfot){
Serializableret=commonDao.add(t);
returnret!
=null;
管理员模块
管理员对角色管理功能:
publicclassRoleActionextendsActionSupport{
privateIRoleServiceroleService;
privateIRightServicerightService;
privateRoleinforole;
publicvoidsetRoleService(IRoleServiceroleService){
this.roleService=roleService;
publicvoidsetRightService(IRightServicerightService){
this.rightService=rightService;
publicRoleinfogetRole(){
returnrole;
publicvoidsetRole(Roleinforole){
this.role=role;
publicStringtoList()
Roleinfo>
roles=roleService.getList();
ServletActionContext.getRequest().setAttribute("
ROLES"
roles);
publicStringtoAssign()
Rightinfo>
rights=rightService.getAllRights();
Roleinfor=roleService.getRoleWithRights(role.getRoleId());
for(Rightinforight:
rights)
if(r.getRights().contains(right))
{
right.setChecked("
checked"
ROLE"
r);
RIGHTS"
rights);
assign"
publicStringdoAssign()throwsException
HttpServletRequestrequest=ServletActionContext.getRequest();
String[]newRights=request.getParameterValues("
CheckBox_Rights"
roleService.updateRoleRights(role.getRoleId(),newRights);
HttpServletResponseresponse=ServletActionContext.getResponse();
response.sendRedirect("
role!
toAssign.action?
role.roldId="
+role.getRoleId()+"
message=ok"
returnnull;
publicclassRightServiceImpl_HimplementsIRightService{
privateICommonDAOcommonDao;
publicvoidsetCommonDao(ICommonDAOcommonDao){
monDao=commonDao;
publicList<
getAllRights(){
fromRightinfo"
list=commonDao.list(hql);
管理员对用户管理功能:
(增、删、改、查)
publicStringdelete()
intuid=Integer.parseInt(ServletActionContext.getRequest().getParameter("
userid"
booleanflag=userService.delete(uid);
if(flag)
list1"
//编辑用户
publicStringtoedit()
intuid=Integer.parseInt(ServletActionContext.getRequest().getParameter("
Userinfouu=userService.detail(uid);
USER2"
edit"
publicStringedit()
booleanflag=userService.update(user);
edit_error"
publicStringdetail()
USER1"
detail"
publicStringadd()
if(userService.addUser(user)==true)
List<
user=userService.list();
USERS"
user);
publicStringtoadd()
publicStringdoLogin()
publicbooleanaddUser(Userinfou){
Serializableret=commonDao.add(u);
publicListlist(){
Stringhql="
publicUserinfodetail(intuserid){