当前位置:   article > 正文

Java项目:家政服务管理系统(java+JSP+JavaScript+HTML+Mysql)_listemploy

listemploy

源码获取:俺的博客首页 "资源" 里下载!

项目介绍

雇主用户角色包含以下功能:
首页,注册账号,雇主登录,查询家政阿姨,查看供求信息,查看家政公司,阿姨预约,查看我的预约,发布需求信息等功能。

管理员角色包含以下功能:
登录,添加新闻,家政合同管理,家政阿姨管理,审核供应信息,企业用户管理,雇主管理等功能。

家政阿姨角色包含以下功能:
登陆页面,发布供应信息,管理我的预约等功能。

家政公司角色包含以下功能:
登录,发布家政名片等功能。

环境需要

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版本;


技术栈

HTML+CSS+JavaScript+jsp+mysql


使用说明

1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,输入localhost:8080/login.jsp 登录

 

 

 

 

 

 

用户管理控制层:

  1. //定义为控制器
  2. @Controller
  3. // 设置路径
  4. @RequestMapping(value = "/users", produces = "text/plain;charset=utf-8")
  5. public class UsersController extends BaseController {
  6. // 注入Service 由于标签的存在 所以不需要getter setter
  7. @Autowired
  8. @Resource
  9. private UsersService usersService;
  10. // 准备添加数据
  11. @RequestMapping("/createUsers")
  12. public String createUsers() {
  13. return "admin/addusers";
  14. }
  15. // 添加数据
  16. @RequestMapping("/addUsers")
  17. public String addUsers(Users users) {
  18. this.usersService.insertUsers(users);
  19. return "redirect:/users/createUsers";
  20. }
  21. // 通过主键删除数据
  22. @RequestMapping("/deleteUsers")
  23. public String deleteUsers(String id) {
  24. this.usersService.deleteUsers(id);
  25. return "redirect:/users/getAllUsers";
  26. }
  27. // 批量删除数据
  28. @RequestMapping("/deleteUsersByIds")
  29. public String deleteUsersByIds() {
  30. String[] ids = this.getRequest().getParameterValues("usersid");
  31. for (String usersid : ids) {
  32. this.usersService.deleteUsers(usersid);
  33. }
  34. return "redirect:/users/getAllUsers";
  35. }
  36. // 更新数据
  37. @RequestMapping("/updateUsers")
  38. public String updateUsers(Users users) {
  39. this.usersService.updateUsers(users);
  40. return "redirect:/users/getAllUsers";
  41. }
  42. // 显示全部数据
  43. @RequestMapping("/getAllUsers")
  44. public String getAllUsers(String number) {
  45. List<Users> usersList = this.usersService.getAllUsers();
  46. PageHelper.getPage(usersList, "users", null, null, 10, number, this.getRequest(), null);
  47. return "admin/listusers";
  48. }
  49. // 按条件查询数据 (模糊查询)
  50. @RequestMapping("/queryUsersByCond")
  51. public String queryUsersByCond(String cond, String name, String number) {
  52. Users users = new Users();
  53. if (cond != null) {
  54. if ("username".equals(cond)) {
  55. users.setUsername(name);
  56. }
  57. if ("password".equals(cond)) {
  58. users.setPassword(name);
  59. }
  60. if ("realname".equals(cond)) {
  61. users.setRealname(name);
  62. }
  63. if ("sex".equals(cond)) {
  64. users.setSex(name);
  65. }
  66. if ("birthday".equals(cond)) {
  67. users.setBirthday(name);
  68. }
  69. if ("contact".equals(cond)) {
  70. users.setContact(name);
  71. }
  72. if ("regdate".equals(cond)) {
  73. users.setRegdate(name);
  74. }
  75. }
  76. List<String> nameList = new ArrayList<String>();
  77. List<String> valueList = new ArrayList<String>();
  78. nameList.add(cond);
  79. valueList.add(name);
  80. PageHelper.getPage(this.usersService.getUsersByLike(users), "users", nameList, valueList, 10, number, this.getRequest(), "query");
  81. name = null;
  82. cond = null;
  83. return "admin/queryusers";
  84. }
  85. // 按主键查询数据
  86. @RequestMapping("/getUsersById")
  87. public String getUsersById(String id) {
  88. Users users = this.usersService.getUsersById(id);
  89. this.getRequest().setAttribute("users", users);
  90. return "admin/editusers";
  91. }
  92. public UsersService getUsersService() {
  93. return usersService;
  94. }
  95. public void setUsersService(UsersService usersService) {
  96. this.usersService = usersService;
  97. }
  98. }

员工管理控制层:

  1. //定义为控制器
  2. @Controller
  3. // 设置路径
  4. @RequestMapping(value = "/employ", produces = "text/plain;charset=utf-8")
  5. public class EmployController extends BaseController {
  6. // 注入Service 由于标签的存在 所以不需要getter setter
  7. @Autowired
  8. @Resource
  9. private EmployService employService;
  10. // 准备添加数据
  11. @RequestMapping("/createEmploy")
  12. public String createEmploy() {
  13. return "admin/addemploy";
  14. }
  15. // 添加数据
  16. @RequestMapping("/addEmploy")
  17. public String addEmploy(Employ employ) {
  18. this.employService.insertEmploy(employ);
  19. return "redirect:/employ/createEmploy";
  20. }
  21. // 通过主键删除数据
  22. @RequestMapping("/deleteEmploy")
  23. public String deleteEmploy(String id) {
  24. this.employService.deleteEmploy(id);
  25. return "redirect:/employ/getAllEmploy";
  26. }
  27. // 批量删除数据
  28. @RequestMapping("/deleteEmployByIds")
  29. public String deleteEmployByIds() {
  30. String[] ids = this.getRequest().getParameterValues("employid");
  31. for (String employid : ids) {
  32. this.employService.deleteEmploy(employid);
  33. }
  34. return "redirect:/employ/getAllEmploy";
  35. }
  36. // 更新数据
  37. @RequestMapping("/updateEmploy")
  38. public String updateEmploy(Employ employ) {
  39. this.employService.updateEmploy(employ);
  40. return "redirect:/employ/getAllEmploy";
  41. }
  42. // 显示全部数据
  43. @RequestMapping("/getAllEmploy")
  44. public String getAllEmploy(String number) {
  45. List<Employ> employList = this.employService.getAllEmploy();
  46. PageHelper.getPage(employList, "employ", null, null, 10, number, this.getRequest(), null);
  47. return "admin/listemploy";
  48. }
  49. // 按条件查询数据 (模糊查询)
  50. @RequestMapping("/queryEmployByCond")
  51. public String queryEmployByCond(String cond, String name, String number) {
  52. Employ employ = new Employ();
  53. if (cond != null) {
  54. if ("realname".equals(cond)) {
  55. employ.setRealname(name);
  56. }
  57. if ("sex".equals(cond)) {
  58. employ.setSex(name);
  59. }
  60. if ("birthday".equals(cond)) {
  61. employ.setBirthday(name);
  62. }
  63. if ("idcard".equals(cond)) {
  64. employ.setIdcard(name);
  65. }
  66. if ("jiguan".equals(cond)) {
  67. employ.setJiguan(name);
  68. }
  69. if ("minzu".equals(cond)) {
  70. employ.setMinzu(name);
  71. }
  72. if ("workdate".equals(cond)) {
  73. employ.setWorkdate(name);
  74. }
  75. if ("contact".equals(cond)) {
  76. employ.setContact(name);
  77. }
  78. if ("memo".equals(cond)) {
  79. employ.setMemo(name);
  80. }
  81. }
  82. List<String> nameList = new ArrayList<String>();
  83. List<String> valueList = new ArrayList<String>();
  84. nameList.add(cond);
  85. valueList.add(name);
  86. PageHelper.getPage(this.employService.getEmployByLike(employ), "employ", nameList, valueList, 10, number, this.getRequest(), "query");
  87. name = null;
  88. cond = null;
  89. return "admin/queryemploy";
  90. }
  91. // 按主键查询数据
  92. @RequestMapping("/getEmployById")
  93. public String getEmployById(String id) {
  94. Employ employ = this.employService.getEmployById(id);
  95. this.getRequest().setAttribute("employ", employ);
  96. return "admin/editemploy";
  97. }
  98. public EmployService getEmployService() {
  99. return employService;
  100. }
  101. public void setEmployService(EmployService employService) {
  102. this.employService = employService;
  103. }
  104. }

管理员管理控制层:

  1. //定义为控制器
  2. @Controller
  3. // 设置路径
  4. @RequestMapping(value = "/admin", produces = "text/plain;charset=utf-8")
  5. public class AdminController extends BaseController {
  6. // 注入Service 由于标签的存在 所以不需要getter setter
  7. @Autowired
  8. @Resource
  9. private AdminService adminService;
  10. // 管理员登录 1 验证用户名是否存在 2 验证密码是否正确
  11. @RequestMapping("/login")
  12. public String login() {
  13. String username = this.getRequest().getParameter("username");
  14. String password = this.getRequest().getParameter("password");
  15. Admin adminpojo = new Admin();
  16. adminpojo.setUsername(username);
  17. List<Admin> adminlist = this.adminService.getAdminByCond(adminpojo);
  18. if (adminlist.size() == 0) {
  19. this.getRequest().setAttribute("message", "用户名不存在");
  20. return "admin/index";
  21. } else {
  22. Admin admin = adminlist.get(0);
  23. if (password.equals(admin.getPassword())) {
  24. this.getSession().setAttribute("adminid", admin.getAdminid());
  25. this.getSession().setAttribute("adminname", admin.getUsername());
  26. this.getSession().setAttribute("realname", admin.getRealname());
  27. this.getSession().setAttribute("role", admin.getRole());
  28. } else {
  29. this.getRequest().setAttribute("message", "密码错误");
  30. return "admin/index";
  31. }
  32. }
  33. return "admin/main";
  34. }
  35. // 修改密码
  36. @RequestMapping("/editpwd")
  37. public String editpwd() {
  38. String adminid = (String) this.getSession().getAttribute("adminid");
  39. String password = this.getRequest().getParameter("password");
  40. String repassword = this.getRequest().getParameter("repassword");
  41. Admin admin = this.adminService.getAdminById(adminid);
  42. if (password.equals(admin.getPassword())) {
  43. admin.setPassword(repassword);
  44. this.adminService.updateAdmin(admin);
  45. } else {
  46. this.getRequest().setAttribute("message", "旧密码错误");
  47. }
  48. return "admin/editpwd";
  49. }
  50. // 管理员退出登录
  51. @RequestMapping("/exit")
  52. public String exit() {
  53. this.getSession().removeAttribute("adminid");
  54. this.getSession().removeAttribute("adminname");
  55. this.getSession().removeAttribute("realname");
  56. this.getSession().removeAttribute("role");
  57. return "admin/index";
  58. }
  59. // 准备添加数据
  60. @RequestMapping("/createAdmin")
  61. public String createAdmin() {
  62. return "admin/addadmin";
  63. }
  64. // 添加数据
  65. @RequestMapping("/addAdmin")
  66. public String addAdmin(Admin admin) {
  67. admin.setAddtime(VeDate.getStringDateShort());
  68. this.adminService.insertAdmin(admin);
  69. return "redirect:/admin/createAdmin";
  70. }
  71. // 通过主键删除数据
  72. @RequestMapping("/deleteAdmin")
  73. public String deleteAdmin(String id) {
  74. this.adminService.deleteAdmin(id);
  75. return "redirect:/admin/getAllAdmin";
  76. }
  77. // 批量删除数据
  78. @RequestMapping("/deleteAdminByIds")
  79. public String deleteAdminByIds() {
  80. String[] ids = this.getRequest().getParameterValues("adminid");
  81. for (String adminid : ids) {
  82. this.adminService.deleteAdmin(adminid);
  83. }
  84. return "redirect:/admin/getAllAdmin";
  85. }
  86. // 更新数据
  87. @RequestMapping("/updateAdmin")
  88. public String updateAdmin(Admin admin) {
  89. this.adminService.updateAdmin(admin);
  90. return "redirect:/admin/getAllAdmin";
  91. }
  92. // 显示全部数据
  93. @RequestMapping("/getAllAdmin")
  94. public String getAllAdmin(String number) {
  95. List<Admin> adminList = this.adminService.getAllAdmin();
  96. PageHelper.getPage(adminList, "admin", null, null, 10, number, this.getRequest(), null);
  97. return "admin/listadmin";
  98. }
  99. // 按条件查询数据 (模糊查询)
  100. @RequestMapping("/queryAdminByCond")
  101. public String queryAdminByCond(String cond, String name, String number) {
  102. Admin admin = new Admin();
  103. if (cond != null) {
  104. if ("username".equals(cond)) {
  105. admin.setUsername(name);
  106. }
  107. if ("password".equals(cond)) {
  108. admin.setPassword(name);
  109. }
  110. if ("realname".equals(cond)) {
  111. admin.setRealname(name);
  112. }
  113. if ("contact".equals(cond)) {
  114. admin.setContact(name);
  115. }
  116. if ("role".equals(cond)) {
  117. admin.setRole(name);
  118. }
  119. if ("addtime".equals(cond)) {
  120. admin.setAddtime(name);
  121. }
  122. }
  123. List<String> nameList = new ArrayList<String>();
  124. List<String> valueList = new ArrayList<String>();
  125. nameList.add(cond);
  126. valueList.add(name);
  127. PageHelper.getPage(this.adminService.getAdminByLike(admin), "admin", nameList, valueList, 10, number, this.getRequest(), "query");
  128. name = null;
  129. cond = null;
  130. return "admin/queryadmin";
  131. }
  132. // 按主键查询数据
  133. @RequestMapping("/getAdminById")
  134. public String getAdminById(String id) {
  135. Admin admin = this.adminService.getAdminById(id);
  136. this.getRequest().setAttribute("admin", admin);
  137. return "admin/editadmin";
  138. }
  139. public AdminService getAdminService() {
  140. return adminService;
  141. }
  142. public void setAdminService(AdminService adminService) {
  143. this.adminService = adminService;
  144. }
  145. }

源码获取:俺的博客首页 "资源" 里下载! 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/155104
推荐阅读
相关标签
  

闽ICP备14008679号