源码获取:博客首页 "资源" 里下载!
一、项目简述
功能包括: 家政服务网站系统,用户注册,登录,分为家政人员,普 通用户,以及最高管理员,包括家政分类查询,展示,线 上预约服务,家政申请,评论,留言沟通・,联系家政服 务,家政人员的认证,职业认证,以及后台的维护等等功能。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + maven等等。
员工控制层:
//定义为控制器
@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 = "/goods", produces = "text/plain;charset=utf-8")
public class GoodsController extends BaseController {
// 注入Service 由于标签的存在 所以不需要getter setter
@Autowired
@Resource
private GoodsService goodsService;
@Autowired
@Resource
private CateService cateService;
// 准备添加数据
@RequestMapping("/createGoods")
public String createGoods() {
List<Cate> cateList = this.cateService.getAllCate();
this.getRequest().setAttribute("cateList", cateList);
return "admin/addgoods";
}
// 添加数据
@RequestMapping("/addGoods")
public String addGoods(Goods goods) {
goods.setAddtime(VeDate.getStringDateShort());
goods.setHits("0");
goods.setSellnum("0");
this.goodsService.insertGoods(goods);
return "redirect:/goods/createGoods";
}
// 通过主键删除数据
@RequestMapping("/deleteGoods")
public String deleteGoods(String id) {
this.goodsService.deleteGoods(id);
return "redirect:/goods/getAllGoods";
}
// 批量删除数据
@RequestMapping("/deleteGoodsByIds")
public String deleteGoodsByIds() {
String[] ids = this.getRequest().getParameterValues("goodsid");
for (String goodsid : ids) {
this.goodsService.deleteGoods(goodsid);
}
return "redirect:/goods/getAllGoods";
}
// 更新数据
@RequestMapping("/updateGoods")
public String updateGoods(Goods goods) {
this.goodsService.updateGoods(goods);
return "redirect:/goods/getAllGoods";
}
// 显示全部数据
@RequestMapping("/getAllGoods")
public String getAllGoods(String number) {
List<Goods> goodsList = this.goodsService.getAllGoods();
PageHelper.getPage(goodsList, "goods", null, null, 5, number, this.getRequest(), null);
return "admin/listgoods";
}
// 按条件查询数据 (模糊查询)
@RequestMapping("/queryGoodsByCond")
public String queryGoodsByCond(String cond, String name, String number) {
Goods goods = new Goods();
if (cond != null) {
if ("goodsname".equals(cond)) {
goods.setGoodsname(name);
}
if ("image".equals(cond)) {
goods.setImage(name);
}
if ("cateid".equals(cond)) {
goods.setCateid(name);
}
if ("price".equals(cond)) {
goods.setPrice(name);
}
if ("addtime".equals(cond)) {
goods.setAddtime(name);
}
if ("hits".equals(cond)) {
goods.setHits(name);
}
if ("sellnum".equals(cond)) {
goods.setSellnum(name);
}
if ("contents".equals(cond)) {
goods.setContents(name);
}
}
List<String> nameList = new ArrayList<String>();
List<String> valueList = new ArrayList<String>();
nameList.add(cond);
valueList.add(name);
PageHelper.getPage(this.goodsService.getGoodsByLike(goods), "goods", nameList, valueList, 10, number, this.getRequest(), "query");
name = null;
cond = null;
return "admin/querygoods";
}
// 按主键查询数据
@RequestMapping("/getGoodsById")
public String getGoodsById(String id) {
Goods goods = this.goodsService.getGoodsById(id);
this.getRequest().setAttribute("goods", goods);
List<Cate> cateList = this.cateService.getAllCate();
this.getRequest().setAttribute("cateList", cateList);
return "admin/editgoods";
}
// @GetMapping("/findPage")
// public String getByPage(HttpServletRequest request){
// String pageNow= request.getParameter("pageNow");
// PageInfo<Goods> pageInfo=goodsService.findAll(Integer.valueOf(pageNow),3);
// request.setAttribute("pageInfo",pageInfo);
// return "users/list";
// }
public GoodsService getGoodsService() {
return goodsService;
}
public void setGoodsService(GoodsService goodsService) {
this.goodsService = goodsService;
}
}
订单控制层:
//定义为控制器
@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;
}
}
源码获取:博客首页 "资源" 里下载!