赞
踩
源码获取:俺的博客首页 "资源" 里下载!
雇主用户角色包含以下功能:
首页,注册账号,雇主登录,查询家政阿姨,查看供求信息,查看家政公司,阿姨预约,查看我的预约,发布需求信息等功能。
管理员角色包含以下功能:
登录,添加新闻,家政合同管理,家政阿姨管理,审核供应信息,企业用户管理,雇主管理等功能。
家政阿姨角色包含以下功能:
登陆页面,发布供应信息,管理我的预约等功能。
家政公司角色包含以下功能:
登录,发布家政名片等功能。
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 登录
- //定义为控制器
- @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;
- }
-
- }
- //定义为控制器
- @Controller
- // 设置路径
- @RequestMapping(value = "/employ", produces = "text/plain;charset=utf-8")
- public class EmployController extends BaseController {
- // 注入Service 由于标签的存在 所以不需要getter setter
- @Autowired
- @Resource
- private EmployService employService;
-
- // 准备添加数据
- @RequestMapping("/createEmploy")
- public String createEmploy() {
- return "admin/addemploy";
- }
-
- // 添加数据
- @RequestMapping("/addEmploy")
- public String addEmploy(Employ employ) {
- this.employService.insertEmploy(employ);
- return "redirect:/employ/createEmploy";
- }
-
- // 通过主键删除数据
- @RequestMapping("/deleteEmploy")
- public String deleteEmploy(String id) {
- this.employService.deleteEmploy(id);
- return "redirect:/employ/getAllEmploy";
- }
-
- // 批量删除数据
- @RequestMapping("/deleteEmployByIds")
- public String deleteEmployByIds() {
- String[] ids = this.getRequest().getParameterValues("employid");
- for (String employid : ids) {
- this.employService.deleteEmploy(employid);
- }
- return "redirect:/employ/getAllEmploy";
- }
-
- // 更新数据
- @RequestMapping("/updateEmploy")
- public String updateEmploy(Employ employ) {
- this.employService.updateEmploy(employ);
- return "redirect:/employ/getAllEmploy";
- }
-
- // 显示全部数据
- @RequestMapping("/getAllEmploy")
- public String getAllEmploy(String number) {
- List<Employ> employList = this.employService.getAllEmploy();
- PageHelper.getPage(employList, "employ", null, null, 10, number, this.getRequest(), null);
- return "admin/listemploy";
- }
-
- // 按条件查询数据 (模糊查询)
- @RequestMapping("/queryEmployByCond")
- public String queryEmployByCond(String cond, String name, String number) {
- Employ employ = new Employ();
- if (cond != null) {
- if ("realname".equals(cond)) {
- employ.setRealname(name);
- }
- if ("sex".equals(cond)) {
- employ.setSex(name);
- }
- if ("birthday".equals(cond)) {
- employ.setBirthday(name);
- }
- if ("idcard".equals(cond)) {
- employ.setIdcard(name);
- }
- if ("jiguan".equals(cond)) {
- employ.setJiguan(name);
- }
- if ("minzu".equals(cond)) {
- employ.setMinzu(name);
- }
- if ("workdate".equals(cond)) {
- employ.setWorkdate(name);
- }
- if ("contact".equals(cond)) {
- employ.setContact(name);
- }
- if ("memo".equals(cond)) {
- employ.setMemo(name);
- }
- }
-
- List<String> nameList = new ArrayList<String>();
- List<String> valueList = new ArrayList<String>();
- nameList.add(cond);
- valueList.add(name);
- PageHelper.getPage(this.employService.getEmployByLike(employ), "employ", nameList, valueList, 10, number, this.getRequest(), "query");
- name = null;
- cond = null;
- return "admin/queryemploy";
- }
-
- // 按主键查询数据
- @RequestMapping("/getEmployById")
- public String getEmployById(String id) {
- Employ employ = this.employService.getEmployById(id);
- this.getRequest().setAttribute("employ", employ);
- return "admin/editemploy";
- }
-
- public EmployService getEmployService() {
- return employService;
- }
-
- public void setEmployService(EmployService employService) {
- this.employService = employService;
- }
-
- }
- //定义为控制器
- @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;
- }
-
- }
源码获取:俺的博客首页 "资源" 里下载!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。