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








基于javaweb的SSM+Maven健身房俱乐部管理系统(java+ssm+jsp+bootstrap+layui+mysql)
项目介绍
本项目包含前后台,分为普通用户与管理员两种角色,前台为普通用户登录,后台为管理员登录;
管理员角色包含以下功能: 登录,会员管理-增删改查,员工管理-增删改查,课程管理,网站新闻管理,新闻添加编辑,留言管理等功能。
用户角色包含以下功能: 查看首页,查看关于我们,查看新闻,课程简介,会员注册,会员登录,查看新闻活动,登录后留言,查看留言等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本; 6.是否Maven项目:是;
技术栈
- 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+Layui+bootstrap+jquery
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中db.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/ 登录
——————————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
| * @param limit * @param model * @param ntitle * @return */ @RequestMapping("/admin/newslist.html") @ResponseBody public Map<String, Object> newslistPage(String page, String limit, Model model, String ntitle) { List<Newskinds> newskinds = newsKindsService.selectByExample(new NewskindsExample()); model.addAttribute("newskinds", newskinds); NewsExample newsExample = new NewsExample(); NewsExample.Criteria criteria = newsExample.createCriteria(); if (ntitle != null && !ntitle.equals("")) { criteria.andNtitleLike("%"+ntitle+"%"); } PageHelper.startPage(Integer.parseInt(page), Integer.parseInt(limit)); List<News> news = newsService.selectByExampleWithBLOBs(newsExample); PageInfo<News> pageInfo = new PageInfo<News>(news); Map<String, Object> pageMap = new HashMap<String, Object>(); pageMap.put("code", 0); pageMap.put("msg", ""); pageMap.put("count", pageInfo.getTotal()); pageMap.put("data", pageInfo.getList()); return pageMap; }
@RequestMapping("/admin/news/goaddorupdate.html") public String adminGoaddorupdatePage(Model model, @RequestParam(required = false) String nid) { List<Newskinds> newskinds = newsKindsService.selectByExample(new NewskindsExample()); model.addAttribute("newskinds", newskinds); if (nid != null && !nid.equals("")) { News news = newsService.selectByPrimaryKey(Integer.parseInt(nid));
|
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
| String strDateFormat = "yyyy-MM-dd HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat); request.getSession().setAttribute("daoqi", sdf.format(date)); } TblOrderExample tblOrderExample = new TblOrderExample(); TblOrderExample.Criteria criteria = tblOrderExample.createCriteria(); criteria.andMemberIdEqualTo(member.getMid()); List<TblOrder> orders = orderService.selectByExample(tblOrderExample); List<Order> list = new ArrayList<Order>(); int i = 1; for(TblOrder tblOrder:orders) { Order order = new Order(); order.setTblOrder(tblOrder); order.setId(i); com.stern.pojo.Class class1 = classService.selectByPrimaryKey(tblOrder.getClassId()); Course course = courseService.selectByPrimaryKey(class1.getCourseId()); Employee employee = employeeService.selectByPrimaryKey(course.getTrainerId()); if(course != null) { order.setName(course.getCname()); } if(class1 != null) { order.setShijian(class1.getClasstime()); } if(employee != null) { order.setJiaolian(employee.getEname()); }else { order.setJiaolian("未分配"); } list.add(order); i++; } model.addAttribute("orders",orders); model.addAttribute("result",list); List<Message> messages = messageService.selectMessageWithReply(member.getMid()); model.addAttribute("messages",messages); return "dinggou"; }
@RequestMapping("/admin/message.html") public String adminMsg(){ return "admin/message/messagelist"; }
@RequestMapping("/admin/messagelist.html") @ResponseBody public Map<String,Object> messageList(String page,String limit,String msgcontent){
|
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
| CoursefunctionExample.Criteria criteria2 = coursefunctionExample.createCriteria();
if(cate!=null&&!cate.equals("全部")){ criteria1.andCateNameEqualTo(cate); List<Coursecategory> coursecategories1 = coursecategoryService.selectByExample(coursecategoryExample); criteria.andCcateIdEqualTo(coursecategories1.get(0).getCateId()); } if (func!=null&&!func.equals("全部")){ criteria2.andFnameEqualTo(func); List<Coursefunction> coursefunctions1 = coursefunctionService.selectByExample(coursefunctionExample); criteria.andCfunctionIdEqualTo(coursefunctions1.get(0).getFid()); } PageHelper.startPage(_page,6); List<Course> courses = courseService.selectByExampleWithBLOBs(courseExample); PageInfo<Course> pageInfo = new PageInfo<Course>(courses); int totalPages = pageInfo.getPages(); model.addAttribute("totalPages",totalPages); model.addAttribute("currentPage",_page); model.addAttribute("courses",courses); model.addAttribute("cate",cate); model.addAttribute("func",func); Sheet sheet = courseService.selectSheetByPrimaryKey(1); if(sheet!=null){ model.addAttribute("sheetsrc",sheet.getSsrc()); } return "course"; }
@RequestMapping("/courseinfo.html") public String coursePage(Model model,String cid){ Course course = courseService.selectByPrimaryKey(Integer.parseInt(cid)); model.addAttribute("course",course); ClassExample classExample = new ClassExample();
|
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
| Course course = courseService.selectByPrimaryKey(Integer.parseInt(cid)); model.addAttribute("course",course); ClassExample classExample = new ClassExample(); ClassExample.Criteria criteria = classExample.createCriteria(); criteria.andCourseIdEqualTo(Integer.parseInt(cid)); List<Class> classes = classService.selectByExample(classExample); for (Class aClass : classes) { TblOrderExample tblOrderExample = new TblOrderExample(); TblOrderExample.Criteria criteria1 = tblOrderExample.createCriteria(); criteria1.andClassIdEqualTo(aClass.getClassid()); long haveOrder = orderService.countByExample(tblOrderExample); aClass.setHaveOrder(new Long(haveOrder).intValue()); } model.addAttribute("classes",classes); EmployeeExample employeeExample = new EmployeeExample(); EmployeeExample.Criteria criteria2 = employeeExample.createCriteria(); criteria2.andEpostIdEqualTo(1); List<Employee> trainers = employeeService.selectByExample(employeeExample); model.addAttribute("trainers",trainers); return "courseinfo"; }
@RequestMapping("/admin/course.html") public String admincourse(Model model){ List<Employee> employees = employeeService.selectByExample(new EmployeeExample()); model.addAttribute("employees",employees); List<Coursecategory> coursecategories = coursecategoryService.selectByExample(new CoursecategoryExample()); model.addAttribute("coursecategories",coursecategories); List<Coursefunction> coursefunctions = coursefunctionService.selectByExample(new CoursefunctionExample()); model.addAttribute("coursefunctions",coursefunctions); return "admin/course/courselist"; }
@RequestMapping("/admin/courselist.html")
|
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
| * 上传课程图片 * @param file * @return */ @RequestMapping("/admin/upload.html") @ResponseBody public Map<String,Object> upload(MultipartFile file){ String extName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String filename = System.currentTimeMillis()+extName; File newFile = new File(Thread.currentThread().getContextClassLoader().getResource("").getPath().substring(0,Thread.currentThread().getContextClassLoader().getResource("").getPath().length()-16)+"/sterngymimages/"+filename); try { file.transferTo(newFile); }catch (Exception e){ e.printStackTrace(); } Map<String,String > srcMap = new HashMap<String, String>(); srcMap.put("src",filename); Map<String,Object> imgMap = new HashMap<String,Object>(); imgMap.put("code",0); imgMap.put("msg",""); imgMap.put("data",srcMap); return imgMap; }
@RequestMapping("/admin/courseinfo.html") public String courseInfo(Model model,String cid){ Course course = courseService.selectByPrimaryKey(Integer.parseInt(cid)); model.addAttribute("course",course); EmployeeExample example = new EmployeeExample(); EmployeeExample.Criteria criteria = example.createCriteria(); criteria.andEpostIdEqualTo(1); List<Employee> trainers = employeeService.selectByExample(example); model.addAttribute("trainers",trainers); List<Coursecategory> coursecategories = coursecategoryService.selectByExample(new CoursecategoryExample()); model.addAttribute("coursecategories",coursecategories); List<Coursefunction> coursefunctions = coursefunctionService.selectByExample(new CoursefunctionExample()); model.addAttribute("coursefunctions",coursefunctions); return "admin/course/courseinfo"; }
|
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
| if(member.getDaoqi() != null) { request.getSession().setAttribute("huiyuan", member.getHuiyuan()); Date date = member.getDaoqi(); String strDateFormat = "yyyy-MM-dd HH:mm:ss"; SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat); request.getSession().setAttribute("daoqi", sdf.format(date)); } TblOrderExample tblOrderExample = new TblOrderExample(); TblOrderExample.Criteria criteria = tblOrderExample.createCriteria(); criteria.andMemberIdEqualTo(member.getMid()); List<TblOrder> orders = orderService.selectByExample(tblOrderExample); List<Order> list = new ArrayList<Order>(); int i = 1; for(TblOrder tblOrder:orders) { Order order = new Order(); order.setTblOrder(tblOrder); order.setId(i); com.stern.pojo.Class class1 = classService.selectByPrimaryKey(tblOrder.getClassId()); Course course = courseService.selectByPrimaryKey(class1.getCourseId()); Employee employee = employeeService.selectByPrimaryKey(course.getTrainerId()); if(course != null) { order.setName(course.getCname()); } if(class1 != null) { order.setShijian(class1.getClasstime()); } if(employee != null) { order.setJiaolian(employee.getEname()); }else { order.setJiaolian("未分配"); } list.add(order); i++; } model.addAttribute("orders",orders); model.addAttribute("result",list); List<Message> messages = messageService.selectMessageWithReply(member.getMid()); model.addAttribute("messages",messages); return "dinggou"; }
|
——————————PayStart——————————
项目链接:
https://javayms.github.io?id=011122522008200nq
https://javayms.pages.dev?id=011122522008200nq