本系统主要实现的功能有:
项目功能较多,包括用户的注册登录,家政0员务的查看, 分类,预订,以及支付,订单信息的查看,后台管理员的 人员管理,服务类别管理,订单分配,数据统计,家政维 护等等功能。
1运行环境:
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: Springboot+ SpringMVC + MyBatis + ThymeLeaf + JavaScript + JQuery + Ajax + maven
观看详情:
管理员控制器: //定义为控制器 @Controller // 设置路径 @RequestMapping(value = "/admin", produces = "text/plain;charset=utf-8") public class AdminController extends BaseController { // 注入Service 由于标签的存在 所以不需要getter setter @Autowired @Resource private AdminService adminService; // 管理员登录 1 验证用户名是否存在 2 验证密码是否正确 @RequestMapping("/login") public String login() { String username = this.getRequest().getParameter("username"); String password = this.getRequest().getParameter("password"); Admin adminpojo = new Admin(); adminpojo.setUsername(username); List<Admin> adminlist = this.adminService.getAdminByCond(adminpojo); if (adminlist.size() == 0) { this.getRequest().setAttribute("message", "用户名不存在"); return "admin/index"; } else { Admin admin = adminlist.get(0); if (password.equals(admin.getPassword())) { this.getSession().setAttribute("adminid", admin.getAdminid()); this.getSession().setAttribute("adminname", admin.getUsername()); this.getSession().setAttribute("realname", admin.getRealname()); this.getSession().setAttribute("role", admin.getRole()); } else { this.getRequest().setAttribute("message", "密码错误"); return "admin/index"; } } return "admin/main"; } // 修改密码 @RequestMapping("/editpwd") public String editpwd() { String adminid = (String) this.getSession().getAttribute("adminid"); String password = this.getRequest().getParameter("password"); String repassword = this.getRequest().getParameter("repassword"); Admin admin = this.adminService.getAdminById(adminid); if (password.equals(admin.getPassword())) { admin.setPassword(repassword); this.adminService.updateAdmin(admin); } else { this.getRequest().setAttribute("message", "旧密码错误"); } return "admin/editpwd"; } // 管理员退出登录 @RequestMapping("/exit") public String exit() { this.getSession().removeAttribute("adminid"); this.getSession().removeAttribute("adminname"); this.getSession().removeAttribute("realname"); this.getSession().removeAttribute("role"); return "admin/index"; } // 准备添加数据 @RequestMapping("/createAdmin") public String createAdmin() { return "admin/addadmin"; } // 添加数据 @RequestMapping("/addAdmin") public String addAdmin(Admin admin) { admin.setAddtime(VeDate.getStringDateShort()); this.adminService.insertAdmin(admin); return "redirect:/admin/createAdmin"; } // 通过主键删除数据 @RequestMapping("/deleteAdmin") public String deleteAdmin(String id) { this.adminService.deleteAdmin(id); return "redirect:/admin/getAllAdmin"; } // 批量删除数据 @RequestMapping("/deleteAdminByIds") public String deleteAdminByIds() { String[] ids = this.getRequest().getParameterValues("adminid"); for (String adminid : ids) { this.adminService.deleteAdmin(adminid); } return "redirect:/admin/getAllAdmin"; } // 更新数据 @RequestMapping("/updateAdmin") public String updateAdmin(Admin admin) { this.adminService.updateAdmin(admin); return "redirect:/admin/getAllAdmin"; } // 显示全部数据 @RequestMapping("/getAllAdmin") public String getAllAdmin(String number) { List<Admin> adminList = this.adminService.getAllAdmin(); PageHelper.getPage(adminList, "admin", null, null, 10, number, this.getRequest(), null); return "admin/listadmin"; } // 按条件查询数据 (模糊查询) @RequestMapping("/queryAdminByCond") public String queryAdminByCond(String cond, String name, String number) { Admin admin = new Admin(); if (cond != null) { if ("username".equals(cond)) { admin.setUsername(name); } if ("password".equals(cond)) { admin.setPassword(name); } if ("realname".equals(cond)) { admin.setRealname(name); } if ("contact".equals(cond)) { admin.setContact(name); } if ("role".equals(cond)) { admin.setRole(name); } if ("addtime".equals(cond)) { admin.setAddtime(name); } } List<String> nameList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>(); nameList.add(cond); valueList.add(name); PageHelper.getPage(this.adminService.getAdminByLike(admin), "admin", nameList, valueList, 10, number, this.getRequest(), "query"); name = null; cond = null; return "admin/queryadmin"; } // 按主键查询数据 @RequestMapping("/getAdminById") public String getAdminById(String id) { Admin admin = this.adminService.getAdminById(id); this.getRequest().setAttribute("admin", admin); return "admin/editadmin"; } public AdminService getAdminService() { return adminService; } public void setAdminService(AdminService adminService) { this.adminService = adminService; } } 订单控制器: //定义为控制器 @Controller // 设置路径 @RequestMapping(value = "/orders", produces = "text/plain;charset=utf-8") public class OrdersController extends BaseController { // 注入Service 由于标签的存在 所以不需要getter setter @Autowired @Resource private OrdersService ordersService; @Autowired @Resource private UsersService usersService; // 准备添加数据 @RequestMapping("/createOrders") public String createOrders() { List<Users> usersList = this.usersService.getAllUsers(); this.getRequest().setAttribute("usersList", usersList); return "admin/addorders"; } // 添加数据 @RequestMapping("/addOrders") public String addOrders(Orders orders) { this.ordersService.insertOrders(orders); return "redirect:/orders/createOrders"; } // 通过主键删除数据 @RequestMapping("/deleteOrders") public String deleteOrders(String id) { this.ordersService.deleteOrders(id); return "redirect:/orders/getAllOrders"; } // 批量删除数据 @RequestMapping("/deleteOrdersByIds") public String deleteOrdersByIds() { String[] ids = this.getRequest().getParameterValues("ordersid"); for (String ordersid : ids) { this.ordersService.deleteOrders(ordersid); } return "redirect:/orders/getAllOrders"; } // 更新数据 @RequestMapping("/updateOrders") public String updateOrders(Orders orders) { this.ordersService.updateOrders(orders); return "redirect:/orders/getAllOrders"; } // 显示全部数据 @RequestMapping("/getAllOrders") public String getAllOrders(String number) { List<Orders> ordersList = this.ordersService.getAllOrders(); PageHelper.getPage(ordersList, "orders", null, null, 10, number, this.getRequest(), null); return "admin/listorders"; } // 按条件查询数据 (模糊查询) @RequestMapping("/queryOrdersByCond") public String queryOrdersByCond(String cond, String name, String number) { Orders orders = new Orders(); if (cond != null) { if ("ordercode".equals(cond)) { orders.setOrdercode(name); } if ("usersid".equals(cond)) { orders.setUsersid(name); } if ("total".equals(cond)) { orders.setTotal(name); } if ("addtime".equals(cond)) { orders.setAddtime(name); } if ("status".equals(cond)) { orders.setStatus(name); } if ("address".equals(cond)) { orders.setAddress(name); } if ("contact".equals(cond)) { orders.setContact(name); } if ("workdate".equals(cond)) { orders.setWorkdate(name); } if ("worktime".equals(cond)) { orders.setWorktime(name); } } List<String> nameList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>(); nameList.add(cond); valueList.add(name); PageHelper.getPage(this.ordersService.getOrdersByLike(orders), "orders", nameList, valueList, 10, number, this.getRequest(), "query"); name = null; cond = null; return "admin/queryorders"; } // 按主键查询数据 @RequestMapping("/getOrdersById") public String getOrdersById(String id) { Orders orders = this.ordersService.getOrdersById(id); this.getRequest().setAttribute("orders", orders); List<Users> usersList = this.usersService.getAllUsers(); this.getRequest().setAttribute("usersList", usersList); return "admin/editorders"; } public OrdersService getOrdersService() { return ordersService; } public void setOrdersService(OrdersService ordersService) { this.ordersService = ordersService; } } 用户信息控制器: //定义为控制器 @Controller // 设置路径 @RequestMapping(value = "/users", produces = "text/plain;charset=utf-8") public class UsersController extends BaseController { // 注入Service 由于标签的存在 所以不需要getter setter @Autowired @Resource private UsersService usersService; // 准备添加数据 @RequestMapping("/createUsers") public String createUsers() { return "admin/addusers"; } // 添加数据 @RequestMapping("/addUsers") public String addUsers(Users users) { this.usersService.insertUsers(users); return "redirect:/users/createUsers"; } // 通过主键删除数据 @RequestMapping("/deleteUsers") public String deleteUsers(String id) { this.usersService.deleteUsers(id); return "redirect:/users/getAllUsers"; } // 批量删除数据 @RequestMapping("/deleteUsersByIds") public String deleteUsersByIds() { String[] ids = this.getRequest().getParameterValues("usersid"); for (String usersid : ids) { this.usersService.deleteUsers(usersid); } return "redirect:/users/getAllUsers"; } // 更新数据 @RequestMapping("/updateUsers") public String updateUsers(Users users) { this.usersService.updateUsers(users); return "redirect:/users/getAllUsers"; } // 显示全部数据 @RequestMapping("/getAllUsers") public String getAllUsers(String number) { List<Users> usersList = this.usersService.getAllUsers(); PageHelper.getPage(usersList, "users", null, null, 10, number, this.getRequest(), null); return "admin/listusers"; } // 按条件查询数据 (模糊查询) @RequestMapping("/queryUsersByCond") public String queryUsersByCond(String cond, String name, String number) { Users users = new Users(); if (cond != null) { if ("username".equals(cond)) { users.setUsername(name); } if ("password".equals(cond)) { users.setPassword(name); } if ("realname".equals(cond)) { users.setRealname(name); } if ("sex".equals(cond)) { users.setSex(name); } if ("birthday".equals(cond)) { users.setBirthday(name); } if ("contact".equals(cond)) { users.setContact(name); } if ("regdate".equals(cond)) { users.setRegdate(name); } } List<String> nameList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>(); nameList.add(cond); valueList.add(name); PageHelper.getPage(this.usersService.getUsersByLike(users), "users", nameList, valueList, 10, number, this.getRequest(), "query"); name = null; cond = null; return "admin/queryusers"; } // 按主键查询数据 @RequestMapping("/getUsersById") public String getUsersById(String id) { Users users = this.usersService.getUsersById(id); this.getRequest().setAttribute("users", users); return "admin/editusers"; } public UsersService getUsersService() { return usersService; } public void setUsersService(UsersService usersService) { this.usersService = usersService; } } 源码获取:博客首页 "资源" 里下载!