一、项目简述
本系统主要实现的功能有:
项目功能较多,包括用户的注册登录,家政0员务的查看, 分类,预订,以及支付,订单信息的查看,后台管理员的 人员管理,服务类别管理,订单分配,数据统计,家政维 护等等功能。
二、项目运行
1运行环境:
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持) 项目技术: Springboot+ SpringMVC + MyBatis + ThymeLeaf + JavaScript + JQuery + Ajax + maven
观看详情:
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
@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)) {
} 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 "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);
}
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 ("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);
}
@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();
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";
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";
}
// 通过主键删除数据
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";
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)