作者主页:编程指南针
作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师
主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助
文末获取源码
项目编号:BS-XX-112
一,项目简介
本项目 主要基于SSM框架开发实现一个驾校预约的管理平台,系统分为前后端,前端主要查看驾校的新闻、教练信息、预约练车、在线留言、个人中心管理等,后台主要实现对用户的管理、管理员管理、教练管理、新闻管理、轮播图管理、系统管理、公告管理、留言管理等模块。
二,环境介绍
语言环境:Java: jdk1.8
数据库:Mysql: mysql5.7
应用服务器:Tomcat: tomcat8.5.31
开发工具:IDEA或eclipse
后台开发技术:SSM框架+Javaweb
前端开发技术:JSP+Jquery+JS+CSS
三,系统展示
系统首页
编辑
站内新闻
编辑
驾校教练信息
编辑
在线预约练车
编辑
在线留言
编辑
前端用户登陆
编辑
个人中心之个人资料维护
编辑
个人中心之查看个人预约记录
编辑
后台管理用户登陆
编辑
系统用户管理--管理员管理
编辑
前端用户管理
编辑
教练信息管理
编辑
站内新闻管理
编辑
站内公告管理
编辑
轮播图管理
编辑
友情链接管理
编辑
留言管理
编辑
四,核心代码展示
用户管理控制器
package com.controller; import java.io.File; import java.io.IOException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.io.PrintWriter; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import com.entity.Allusers; //import com.chengxusheji.po.News; import com.server.AllusersServer; import com.util.PageBean; import net.sf.json.JSONObject; @Controller public class AllusersController { @Resource private AllusersServer allusersService; // @RequestMapping("showAllusers.do") public String showAllusers(int id,ModelMap map,HttpSession session){ /* Map<String,Object> bmap=new HashMap<String,Object>(); bmap.put("uid", id);*/ // map.put("blist", allusersService.getAll(bmap)); map.put("allusers", allusersService.getById(id)); return "read"; } @RequestMapping("addAllusers.do") public String addAllusers(HttpServletRequest request,Allusers allusers,HttpSession session){ Timestamp time=new Timestamp(System.currentTimeMillis()); //Users u=(Users)session.getAttribute("user"); /*if(u==null||u.equals("")){ return "redirect:showIndex.do"; }else{*/ //bbs.setUid(u.getId()); /*bbs.setPubtime(time.toString()); bbs.setIsdel("1");*/ allusers.setAddtime(time.toString().substring(0, 19)); allusersService.add(allusers); return "redirect:allusersList.do"; /*}*/ } // 处理编辑 @RequestMapping("doUpdateAllusers.do") public String doUpdateAllusers(int id,ModelMap map,Allusers allusers){ allusers=allusersService.getById(id); map.put("allusers", allusers); return "allusers_updt"; } // @RequestMapping("updateAllusers.do") public String updateAllusers(int id,ModelMap map,Allusers allusers){ allusersService.update(allusers); return "redirect:allusersList.do"; } // 所有List // @RequestMapping("allusersList.do") // public String allusersList(ModelMap map,HttpSession session){ // map.put("list", allusersService.getAll(null)); // map.put("clist", allusersService.getAll(null)); // return "allusers"; // } // 分页查询 @RequestMapping("allusersList.do") public String goodList(@RequestParam(value="page",required=false)String page, ModelMap map,HttpSession session,Allusers allusers, String username, String pwd, String cx){ /*if(session.getAttribute("user")==null){ return "login"; }*/ if(page==null||page.equals("")){ page="1"; } PageBean pageBean=new PageBean(Integer.parseInt(page), 15); Map<String, Object> pmap=new HashMap<String,Object>(); pmap.put("pageno", pageBean.getStart()); pmap.put("pageSize", 15); Map<String, Object> bmap=new HashMap<String, Object>(); Map<String,Object> cmap=new HashMap<String,Object>(); /*pmap.put("uid", ((Users)session.getAttribute("user")).getId()); bmap.put("uid", ((Users)session.getAttribute("user")).getId());*/ if(username==null||username.equals("")){pmap.put("username", null);cmap.put("username", null);}else{pmap.put("username", username);cmap.put("username", username);} if(pwd==null||pwd.equals("")){pmap.put("pwd", null);cmap.put("pwd", null);}else{pmap.put("pwd", pwd);cmap.put("pwd", pwd);} if(cx==null||cx.equals("")){pmap.put("cx", null);cmap.put("cx", null);}else{pmap.put("cx", cx);cmap.put("cx", cx);} int total=allusersService.getCount(bmap); pageBean.setTotal(total); List<Allusers> list=allusersService.getByPage(pmap); map.put("page", pageBean); map.put("list", list); session.setAttribute("p", 1); return "allusers_list"; } // 分页模糊查询 @RequestMapping("vagueAllusersList.do") public String vagueAllusersList(@RequestParam(value="page",required=false)String page, ModelMap map,HttpSession session){ if(page==null||page.equals("")){ page="1"; } PageBean pageBean=new PageBean(Integer.parseInt(page),PageBean.PAGESIZE); Map<String, Object> pmap=new HashMap<String,Object>(); pmap.put("pageno", pageBean.getStart()); pmap.put("pageSize", pageBean.getPageSize()); Map<String, Object> bmap=new HashMap<String, Object>(); /*pmap.put("uid", ((Users)session.getAttribute("user")).getId()); bmap.put("uid", ((Users)session.getAttribute("user")).getId());*/ int total=allusersService.getCount(bmap); pageBean.setTotal(total); List<Allusers> list=allusersService.getByPage(pmap); map.put("page", pageBean); map.put("list", list); session.setAttribute("p", 2); return "queryallusers"; } @RequestMapping("deleteAllusers.do") public String deleteAllusers(int id){ allusersService.delete(id); return "redirect:allusersList.do"; } @RequestMapping("quchongAllusers.do") public void quchongAllusers(Allusers allusers,HttpServletResponse response){ Map<String,Object> map=new HashMap<String,Object>(); map.put("username", allusers.getUsername()); System.out.println("username==="+allusers.getUsername()); System.out.println("username222==="+allusersService.quchongAllusers(map)); JSONObject obj=new JSONObject(); if(allusersService.quchongAllusers(map)!=null){ obj.put("info", "ng"); }else{ obj.put("info", "username可以用!"); } response.setContentType("text/html;charset=utf-8"); PrintWriter out=null; try { out=response.getWriter(); out.print(obj); out.flush(); } catch (IOException e) { e.printStackTrace(); }finally{ out.close(); } } @RequestMapping("Alluserslogin.do") public String checkAllusersLogin(Allusers allusers, HttpSession session) { Map<String,Object> u=new HashMap<String,Object>(); System.out.println("name===" + allusers.getUsername()); u.put("username",allusers.getUsername()); //u.put("utype", "用户"); //Md5.MD5HexEncode(user.getPassword()) u.put("pwd",allusers.getPwd()); allusers = allusersService.allusersLogin(u); if (allusers != null) { session.setAttribute("username", allusers); System.out.println("username=" + allusers); session.removeAttribute("suc"); return "redirect:index.do"; } else { System.out.println("usernafwfwwme="); session.setAttribute("suc", "登录失败!用户名或密码错误!"); return "login"; } } }
教练信息管理控制器
package com.controller; import java.io.File; import java.io.IOException; import java.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.io.PrintWriter; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import com.entity.Jiaolianxinxi; import com.server.JiaolianxinxiServer; import com.util.PageBean; import net.sf.json.JSONObject; import com.util.db; import java.sql.SQLException; import java.sql.*; @Controller public class JiaolianxinxiController { @Resource private JiaolianxinxiServer jiaolianxinxiService; @RequestMapping("addJiaolianxinxi.do") public String addJiaolianxinxi(HttpServletRequest request,Jiaolianxinxi jiaolianxinxi,HttpSession session) throws SQLException{ Timestamp time=new Timestamp(System.currentTimeMillis()); jiaolianxinxi.setAddtime(time.toString().substring(0, 19)); jiaolianxinxiService.add(jiaolianxinxi); session.setAttribute("backxx", "添加成功"); session.setAttribute("backurl", request.getHeader("Referer")); //session.setAttribute("backurl", "jiaolianxinxiList.do"); return "redirect:postback.jsp"; //return "redirect:jiaolianxinxiList.do"; } // 处理编辑 @RequestMapping("doUpdateJiaolianxinxi.do") public String doUpdateJiaolianxinxi(int id,ModelMap map,Jiaolianxinxi jiaolianxinxi){ jiaolianxinxi=jiaolianxinxiService.getById(id); map.put("jiaolianxinxi", jiaolianxinxi); return "jiaolianxinxi_updt"; } @RequestMapping("doUpdateJiaolianxinxi2.do") public String doUpdateJiaolianxinxi2(ModelMap map,Jiaolianxinxi jiaolianxinxi,HttpServletRequest request){ jiaolianxinxi=jiaolianxinxiService.getById(Integer.parseInt((String)request.getSession().getAttribute("uid"))); map.put("jiaolianxinxi", jiaolianxinxi); return "jiaolianxinxi_updt2"; } @RequestMapping("updateJiaolianxinxi2.do") public String updateJiaolianxinxi2(int id,ModelMap map,Jiaolianxinxi jiaolianxinxi){ jiaolianxinxiService.update(jiaolianxinxi); return "redirect:doUpdateJiaolianxinxi2.do"; } // 后台详细 @RequestMapping("jiaolianxinxiDetail.do") public String jiaolianxinxiDetail(int id,ModelMap map,Jiaolianxinxi jiaolianxinxi){ jiaolianxinxi=jiaolianxinxiService.getById(id); map.put("jiaolianxinxi", jiaolianxinxi); return "jiaolianxinxi_detail"; } // 前台详细 @RequestMapping("jlxxDetail.do") public String jlxxDetail(int id,ModelMap map,Jiaolianxinxi jiaolianxinxi){ jiaolianxinxi=jiaolianxinxiService.getById(id); map.put("jiaolianxinxi", jiaolianxinxi); return "jiaolianxinxidetail"; } // @RequestMapping("updateJiaolianxinxi.do") public String updateJiaolianxinxi(int id,ModelMap map,Jiaolianxinxi jiaolianxinxi,HttpServletRequest request,HttpSession session){ jiaolianxinxiService.update(jiaolianxinxi); session.setAttribute("backxx", "修改成功"); session.setAttribute("backurl", request.getHeader("Referer")); return "redirect:postback.jsp"; //String url = request.getHeader("Referer"); //return "redirect:"+url; //return "redirect:jiaolianxinxiList.do"; } // 分页查询 @RequestMapping("jiaolianxinxiList.do") public String jiaolianxinxiList(@RequestParam(value="page",required=false)String page, ModelMap map,HttpSession session,Jiaolianxinxi jiaolianxinxi, String jiaolianzhenghao, String mima, String xingming, String zhaopian, String xingbie, String jiaoling1,String jiaoling2, String shouji, String jiaxiao, String beizhu, String issh){ if(page==null||page.equals("")){ page="1"; } PageBean pageBean=new PageBean(Integer.parseInt(page), 5); Map<String, Object> pmap=new HashMap<String,Object>(); pmap.put("pageno", pageBean.getStart()); pmap.put("pageSize", 5); if(jiaolianzhenghao==null||jiaolianzhenghao.equals("")){pmap.put("jiaolianzhenghao", null);}else{pmap.put("jiaolianzhenghao", jiaolianzhenghao);} if(mima==null||mima.equals("")){pmap.put("mima", null);}else{pmap.put("mima", mima);} if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);} if(zhaopian==null||zhaopian.equals("")){pmap.put("zhaopian", null);}else{pmap.put("zhaopian", zhaopian);} if(xingbie==null||xingbie.equals("")){pmap.put("xingbie", null);}else{pmap.put("xingbie", xingbie);} if(jiaoling1==null||jiaoling1.equals("")){pmap.put("jiaoling1", null);}else{pmap.put("jiaoling1", jiaoling1);} if(jiaoling2==null||jiaoling2.equals("")){pmap.put("jiaoling2", null);}else{pmap.put("jiaoling2", jiaoling2);} if(shouji==null||shouji.equals("")){pmap.put("shouji", null);}else{pmap.put("shouji", shouji);} if(jiaxiao==null||jiaxiao.equals("")){pmap.put("jiaxiao", null);}else{pmap.put("jiaxiao", jiaxiao);} if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);} int total=jiaolianxinxiService.getCount(pmap); pageBean.setTotal(total); List<Jiaolianxinxi> list=jiaolianxinxiService.getByPage(pmap); map.put("page", pageBean); map.put("list", list); session.setAttribute("p", 1); return "jiaolianxinxi_list"; } @RequestMapping("jlxxList.do") public String jlxxList(@RequestParam(value="page",required=false)String page, ModelMap map,HttpSession session,Jiaolianxinxi jiaolianxinxi, String jiaolianzhenghao, String mima, String xingming, String zhaopian, String xingbie, String jiaoling1,String jiaoling2, String shouji, String jiaxiao, String beizhu, String issh){ if(page==null||page.equals("")){ page="1"; } PageBean pageBean=new PageBean(Integer.parseInt(page), 5); Map<String, Object> pmap=new HashMap<String,Object>(); pmap.put("pageno", pageBean.getStart()); pmap.put("pageSize", 5); if(jiaolianzhenghao==null||jiaolianzhenghao.equals("")){pmap.put("jiaolianzhenghao", null);}else{pmap.put("jiaolianzhenghao", jiaolianzhenghao);} if(mima==null||mima.equals("")){pmap.put("mima", null);}else{pmap.put("mima", mima);} if(xingming==null||xingming.equals("")){pmap.put("xingming", null);}else{pmap.put("xingming", xingming);} if(zhaopian==null||zhaopian.equals("")){pmap.put("zhaopian", null);}else{pmap.put("zhaopian", zhaopian);} if(xingbie==null||xingbie.equals("")){pmap.put("xingbie", null);}else{pmap.put("xingbie", xingbie);} if(jiaoling1==null||jiaoling1.equals("")){pmap.put("jiaoling1", null);}else{pmap.put("jiaoling1", jiaoling1);} if(jiaoling2==null||jiaoling2.equals("")){pmap.put("jiaoling2", null);}else{pmap.put("jiaoling2", jiaoling2);} if(shouji==null||shouji.equals("")){pmap.put("shouji", null);}else{pmap.put("shouji", shouji);} if(jiaxiao==null||jiaxiao.equals("")){pmap.put("jiaxiao", null);}else{pmap.put("jiaxiao", jiaxiao);} if(beizhu==null||beizhu.equals("")){pmap.put("beizhu", null);}else{pmap.put("beizhu", beizhu);} int total=jiaolianxinxiService.getCount(pmap); pageBean.setTotal(total); List<Jiaolianxinxi> list=jiaolianxinxiService.getByPage(pmap); map.put("page", pageBean); map.put("list", list); session.setAttribute("p", 1); return "jiaolianxinxilist"; } @RequestMapping("deleteJiaolianxinxi.do") public String deleteJiaolianxinxi(int id,HttpServletRequest request){ jiaolianxinxiService.delete(id); String url = request.getHeader("Referer"); return "redirect:"+url; //return "redirect:jiaolianxinxiList.do"; } @RequestMapping("quchongJiaolianxinxi.do") public void quchongJiaolianxinxi(Jiaolianxinxi jiaolianxinxi,HttpServletResponse response){ Map<String,Object> map=new HashMap<String,Object>(); map.put("jiaolianzhenghao", jiaolianxinxi.getJiaolianzhenghao()); System.out.println("jiaolianzhenghao==="+jiaolianxinxi.getJiaolianzhenghao()); System.out.println("jiaolianzhenghao222==="+jiaolianxinxiService.quchongJiaolianxinxi(map)); JSONObject obj=new JSONObject(); if(jiaolianxinxiService.quchongJiaolianxinxi(map)!=null){ obj.put("info", "ng"); }else{ obj.put("info", "教练证号可以用!"); } response.setContentType("text/html;charset=utf-8"); PrintWriter out=null; try { out=response.getWriter(); out.print(obj); out.flush(); } catch (IOException e) { e.printStackTrace(); }finally{ out.close(); } } }
五,项目总结
本项目主要实现客户在线预约驾校练车功能,有客户操作的前端界面,后台管理的信息界面,系统功能完整,操作简洁,比较适合做毕业设计或课程设计使用。