——————————DescriptionStart——————————
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明






基于javaweb的SSM+Maven心理咨询预约系统(java+ssm+mysql+html)
前端采用html(bootstrap)+ajax
后端为java的ssm框架
部分呢js和css的引入偷懒了,从之前外包做的网站上直接导入,如果失效了请自行百度下载
启动方式:
导入到IDEA
创建你自己的数据库,然后把文件中的sql文件执行即可
启动后访问http://localhost:端口号/index.html
登录:
小张 123456
——————————CodeStart——————————
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| @RequestMapping("login") @ResponseBody public JSONObject login(HttpServletRequest request, HttpServletResponse response) { String username = request.getParameter("username"); String password = request.getParameter("password"); password = util.encrypt(password); System.out.println(username+password); HttpSession session = request.getSession(); student s=studentService.checkLogin(username,password);
if(s!=null){ session.setAttribute("user", s); return util.errorCode(1,"登录成功"); }
return util.errorCode(0,"账号密码错误"); }
@RequestMapping("register") @ResponseBody public JSONObject register(HttpServletRequest request, HttpServletResponse response) { String sno = request.getParameter("username"); String password = request.getParameter("password"); String email = request.getParameter("email"); String deptno = request.getParameter("deptno"); String username = request.getParameter("name");
password = util.encrypt(password); HttpSession session = request.getSession(); boolean flag =studentService.checkRegister(sno,username,password,email,deptno); if(flag){ return util.errorCode(1,"注册成功!"); }
return util.errorCode(0,"注册失败,请检查网络"); }
@RequestMapping("logout") @ResponseBody public boolean logout(HttpServletRequest request,HttpServletResponse response){ Object student = request.getSession().getAttribute("user"); if(student!=null){ request.getSession().removeAttribute("user"); return true; } return false; }
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| return util.errorCode(0,"请重新登录"); } String oldPassword = util.encrypt(request.getParameter("oldpw")); String newPassword = util.encrypt(request.getParameter("newpw")); if(studentService.checkLogin(user.getSno(),oldPassword)!=null){ studentService.updatePassword(user.getSno(),newPassword); request.getSession().removeAttribute("user"); return util.errorCode(1,"修改成功!请重新登录!"); } else{ return util.errorCode(0,"输入密码错误"); } }
}
@Controller public class appointmentController {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| } String oldPassword = util.encrypt(request.getParameter("oldpw")); String newPassword = util.encrypt(request.getParameter("newpw")); if(studentService.checkLogin(user.getSno(),oldPassword)!=null){ studentService.updatePassword(user.getSno(),newPassword); request.getSession().removeAttribute("user"); return util.errorCode(1,"修改成功!请重新登录!"); } else{ return util.errorCode(0,"输入密码错误"); } }
}
@Controller public class appointmentController {
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
@Controller public class appointmentController { private Logger log = Logger.getLogger(appointmentController.class); @Resource private appointmentService appointmentService; @Resource private consultantService consultantService;
@RequestMapping("search") @ResponseBody public JSONArray search(HttpServletRequest request, HttpServletResponse response){ List<appointment> appointments = new ArrayList<appointment>(); HttpSession session = request.getSession(); student st = (student)session.getAttribute("user"); appointments = appointmentService.selectBySno(st.getSno());
JSONArray json = new JSONArray();
for(appointment app : appointments){ JSONObject tmp = new JSONObject();
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
@Controller public class consultantController {
private Logger log = Logger.getLogger(consultantController.class); @Resource private consultantService consultantService;
@RequestMapping(value = "showAll") @ResponseBody public JSONArray showAll(HttpServletRequest request, HttpServletResponse response) { List<consultant> consultants = consultantService.getConsultant();
JSONArray json = new JSONArray();
for(consultant c : consultants){ JSONObject tmp = new JSONObject(); tmp.put("tno",c.getTno()); tmp.put("tname", c.getConsultantName()); tmp.put("email", c.getConsultantEmail()); tmp.put("location", c.getLocation()); tmp.put("dutytime",c.getDutyTime()); tmp.put("currentnumber",c.getCurrenNumber()); tmp.put("totalnumber",c.getTotalNumber()); json.add(tmp); }
return json; }
@RequestMapping("searchTname") @ResponseBody public JSONArray searchTname(HttpServletResponse response,HttpServletRequest request){ String tname = request.getParameter("tname"); List<consultant> consultants = consultantService.selectByTname(tname); JSONArray json = new JSONArray(); for(consultant c : consultants){ JSONObject consult = new JSONObject(); consult.put("tno",c.getTno()); consult.put("tname", c.getConsultantName()); consult.put("email", c.getConsultantEmail()); consult.put("location", c.getLocation()); consult.put("dutytime",c.getDutyTime()); consult.put("currentnumber",c.getCurrenNumber());
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| return false; }else return true; }
@Override public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception { if(modelAndView != null){ modelAndView.addObject("var", "测试postHandle"); } }
@Override public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { } }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=551923372708201cj
https://javayms.pages.dev?id=551923372708201cj