jdk1.8 + tomcat8.5 + mysql + hbuilderx(webstorm也行)+ eclispe(intellij idea,eclispe,myeclispe,sts都支持)。
spring + springboot+ mybatis + maven + vue 等等组成,b/s模式 + maven管理等等。
用户管理控制器:
/** * 用户管理控制器 */@requestmapping("/ur/家人用英语怎么说")@controllerpublic class urcontroller { @autowired private iurrvice urrvice; @autowired private irolervice rolervice; @resource private procesngineconfiguration configuration; @resource private procesngine engine; @getmapping("/index") @apioperation("跳转用户页接口") @preauthorize("hasrole('管理员')") public string index(string menuid,model model){ list<role> roles = queryallrole(); model.addattribute("roles",roles); model.addattribute("menuid",menuid); //用户首页 return "views/ur/ur_list"; } @getmapping("/listpage") @apioperation("查询用户分页数据接口") @apiimplicitparams({ @apiimplicitparam(name = "urquery", value = "用户查询对象", defaultvalue = "urquery对象") }) @responbody @preauthorize("hasrole('管理员')") public pagelist listpage(urquery urquery){ return urrvice.listpage(urquery); } //添加用户 @postmapping("/addur") @apioperation("添加用户接口") @responbody pput词组ublic map<string,object> addur(ur ur){ map<string, object> ret = new hashmap<>(); ret.put("code",-1); if(stringutils.impty(ur.geturname())){ ret.put("msg","请填写用户名"); return ret; } if(stringutils.impty(ur.getpassword())){ ret.put("msg","请填写密码"); return ret; } if(stringutils.impty(ur.getemail())){ ret.put("msg","请填写邮箱"); return ret; } if(stringutils.impty(ur.gettel())){ ret.put("msg","请填写手机号"); return ret; } if(stringutils.impty(ur.getheadimg())){ ret.put("msg","请上传头像"); return ret; } if(urrvice.addur(ur)<=0) { ret.put("msg", "添加用户失败"); return ret; } ret.put("code",0); ret.put("msg","添加用户成功"); return ret; } /** * 修改用户信息操作 * @param ur * @return */ @postmapping("/editsaveur") @apioperation("修改用户接口") @preauthorize("hasrole('管理员')") @responbody public message editsaveur(ur ur){ if(stringutils.impty(ur.geturname())){ return message.error("请填写用户名"); } if(stringutils.impty(ur.getemail())){ return message.error("请填写邮箱"); } if(stringutils.impty(ur.gettel())){ return message.error("请填写手机号"); } try { urrvice.editsaveur(ur); return message.success(); } catch (exception e) { e.printstacktrace(); return message.error("修改用户信息失败"); } } //添加用户 @getmapping("/deleteur") @apioperation("删除用户接口") @apiimplicitparams({ @apiimplicitparam(name = "id", value = "如:88",required = true) }) @preauthorize("hasrole('管理员')") @responbody public ajaxresult deleteur(@requestparam(required = true) long id){ ajaxresult ajaxresult = new ajaxresult(); try { urrvice.deleteur(id); } catch (exception e) { e.printstacktrace(); return new ajaxresult("删除失败"); } return ajaxresult; } @postmapping(value="/deletebatchur") @apioperation("批量删除用户接口") @preauthorize("hasrole('管理员')") @responbody public ajaxresult deletebatchur(string ids){ string[] idsarr = ids.split(","); list list = new arraylist(); for(int i=0;i<idsarr.length;i++){ list.add(idsarr[i]); } try{ urrvice.batchremove(list); return new ajaxresult(); }catch(exception e){ return new ajaxresult("批量删除失败"); } } //查询所有角色 public list<role> queryallrole(){ return rolervice.queryall(); } //添加用户的角色 @postmapping("/addurrole") @apioperation("添加用户角色接口") @apiimplicitparams({ @apiimplicitparam(name = "parammap", value = "如:{urid:1,[1,2,中国热带地区3,4]]}") }) @responbody public ajaxresult addurrole(@requestbody map parammap){ ajaxresult ajaxresult = new ajaxresult(); string urid = (string)parammap.get("urid"); list roleids = (list) parammap.get("roleids"); try { //添加用户对应的角色 rolervice.addurrole(urid,roleids); 教育机构哪个好 return ajaxresult; }catch (exception e){ e.printstacktrace(); return new ajaxresult("保存角色失败"); } } //添加用户 @requestmapping("/regsaveur") @responbody public long addteacher(ur ur){ system.out.println("保存用户...."+ur); urrvice.addur(ur); //保存工作流程操作 identityrvice is = engine.getidentityrvice(); // 添加用户组 org.activiti.engine.identity.ur urinfo = urrvice.saveur(is, ur.geturname()); // 添加用户对应的组关系 group stugroup = new groupentityimpl(); stugroup.tid("stugroup"); group tgroup = new groupentityimpl(); tgroup.tid("tgroup"); if(ur.gettype() == 2) { //保存老师组 urrvice.saverel(is, urinfo, tgroup); } if(ur.gettype() == 3) { //保存学生组 urrvice.saverel(is, urinfo, stugroup); } long urid = ur.getid(); return urid; } /** * 修改密码页面 * @return */ @requestmapping(value="/update_pwd",method=requestmethod.get) public string updatepwd(){ return "views/ur/update_pwd"; } /** * 修改密码操作 * @param oldpwd * @param newpwd * @return */ @responbody @postmapping("/update_pwd") public message updatepassword(@requestparam(name="oldpwd",required=true)string oldpwd, @requestparam(name="newpwd",required=true)string newpwd){ string urname = commonutils.getloginur().geturname(); ur urbyurname = urrvice.findurbyurname(urname); if(urbyurname!=null){ string password = urbyurname.getpassword(); bcryptpasswordencoder bcryptpasswordencoder = new bcryptpasswordencoder(); boolean matches = bcryptpasswordencoder.matches(oldpwd, password); if(!matches){ return message.error("旧密码不正确");//true } urbyurname.tpassword(bcryptpasswordencoder.encode(newpwd)); if(urrvice.editurpassword(urbyurname)<=0){ return message.error("密码修改失败"); } } return message.success(); } /** * 清除缓存 * @param request * @param respon * @return */ @responbody @postmapping("/clear_cache") public message clearcache(httprvletrequest request, httprvletrespon respon) throws rvletexception, ioexception { respon.theader("cache-control","no-store"); respon.theader("pragrma","no-cache"); respon.tdateheader("expires",0); return message.success(); }}
角色管理控制层:
@controllerpublic class rolecontroller { @autowired private irolervice rolervice; @autowired private ipermissionrvice permissionrvice; @preauthorize("hasrole('管理员')") @responbody @requestmapping("/role/doadd") public string doadd(role role){ //角色添加 return "ok"; } //添加角色 @requestmapping("/role/addrole") @preauthorize("hasrole('管理员')") @responbody public ajaxresult addrole(role role){ system.out.println("保存角色...."+role); try { rolervice.saverole(role); return new ajaxresult(); } catch (exception e) { e.printstacktrace(); return new ajaxresult("操作失败"); } } @preauthorize("hasrole('管理员')") @requestmapping("/role/index") public string index(model model){ list<permission> permisisons = permissionrvice.findallpermisisons(); model.addattribute("permissions",permisisons); //返回角色 return "views/role/role_list"; } @requestmapping("/role/listpage") @responbody public pagelist listpage(rolequery rolequery){ system.out.println("传递参数:"+rolequery); return rolervice.listpage(rolequery); } //修改用户editsaveur @requestmapping("/role/editsaverole") @responbody public ajaxresult editsaverole(role role){ system.out.println("修改角色...."+role); try { rolervice.editsaverole(role); return new ajaxresult(); } catch (exception e) { e.printstacktrace(); } return new ajaxresult("修改失败"); } //添加角色 @requestmapping("/role/deleterole") @responbody public ajaxresult deleterole(long id){ system.out.println("删除角色...."+id); ajaxresult ajaxresult = new ajaxresult(); try { rolervice.deleterole(id); } catch (exception e) { e.printstacktrace(); return new ajaxresult("删除失败"); } return ajaxresult; } //添加角色权限 addrolepermission @requestmapping("/role/add免费申请qq靓号rolepermission") @responbody public ajaxresult addrolepermission(@requestbody map parammap){ ajaxresult ajaxresult = new ajaxresult(); string roleid = (string)parammap.get("roleid"); list permissionids = (list) parammap.get("permissionids"); try { //添加角色对应的权限 rolervice.addrolepermission(roleid,permissionids); return ajaxresult; }catch (exception e){ e.printstacktrace(); return new ajaxresult("保存权限失败"); } } }
到此这篇关于java毕业设计实战之教室预订管理系统的实现的文章就介绍到这了,更多相关java 教室预订管理内容请搜索www.887551.com以前的文章或继续浏览下面的相关文章希望大家以后多多支持www.887551.com!
本文发布于:2023-04-04 21:56:11,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/f7982592639aaab672794e6ef3850652.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:Java毕业设计实战之教室预订管理系统的实现.doc
本文 PDF 下载地址:Java毕业设计实战之教室预订管理系统的实现.pdf
留言与评论(共有 0 条评论) |