基于javaweb和mysql的ssm员工订餐系统(java+ssm+jsp+jquery+mysql)

私信源码获取及调试交流

私信源码获取及调试交流

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb的SSM员工订餐系统(java+ssm+jsp+jquery+mysql)

项目介绍

本项目分为前后台,前台为普通用户登录,后台为管理员登录;

用户角色包含以下功能: 用户登录与注册,查看首页,查看菜品详情,查看购物车,提交订单,查看订单,修改个人信息等功能。

管理员角色包含以下功能: 管理员登录,员工信息管理,菜品信息管理,订单信息管理等功能。

环境需要

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版本; 6.是否Maven项目:否;

技术栈

  1. 后端:Spring+SpringMVC+Mybatis 2. 前端:JSP+CSS+JavaScript+jQuery

使用说明

  1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven; 若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中springmvc-servlet.xml配置文件中的数据库配置改为自己的配置; 4. 运行项目,在浏览器中输入http://localhost:8080/ 登录
	public String deleteDetailsByIds() {
		String[] ids = this.getRequest().getParameterValues("detailsid");
		for (String detailsid : ids) {
			this.detailsService.deleteDetails(detailsid);
		}
		return "redirect:/details/getAllDetails.action";
	}

	// 更新数据
	@RequestMapping("updateDetails.action")
	public String updateDetails(Details details) {
		this.detailsService.updateDetails(details);
		return "redirect:/details/getAllDetails.action";
	}

	// 显示全部数据
	@RequestMapping("getAllDetails.action")
	public String getAllDetails(String number) {
		List<Details> detailsList = this.detailsService.getAllDetails();
		PageHelper.getPage(detailsList, "details", null, null, 10, number, this.getRequest(), null);
		return "admin/listdetails";
	}

	// 按条件查询数据 (模糊查询)
	@RequestMapping("queryDetailsByCond.action")
	public String queryDetailsByCond(String cond, String name, String number) {
		Details details = new Details();
		if (cond != null) {
			if ("ordercode".equals(cond)) {
				details.setOrdercode(name);
			}
			if ("jiancaiid".equals(cond)) {
				details.setJiancaiid(name);
			}
			if ("num".equals(cond)) {
				details.setNum(name);
			}
			if ("price".equals(cond)) {
				details.setPrice(name);
			}

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/city", produces = "text/plain;charset=utf-8")
public class CityAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private CityService cityService;

	// 准备添加数据
	@RequestMapping("createCity.action")
	public String createCity() {
		return "admin/addcity";
	}

	// 添加数据
	@RequestMapping("addCity.action")
	public String addCity(City city) {
		this.cityService.insertCity(city);
		return "redirect:/city/createCity.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteCity.action")
	public String deleteCity(String id) {
		this.cityService.deleteCity(id);
		return "redirect:/city/getAllCity.action";
	}

	// 批量删除数据
	@RequestMapping("deleteCityByIds.action")
	public String deleteCityByIds() {
		String[] ids = this.getRequest().getParameterValues("cityid");
		for (String cityid : ids) {
			this.cityService.deleteCity(cityid);
		}
		return "redirect:/city/getAllCity.action";
	}

	// 更新数据
	@RequestMapping("updateCity.action")
	public String updateCity(City city) {
		this.cityService.updateCity(city);
		return "redirect:/city/getAllCity.action";
	}

	// 显示全部数据
			buffer.append("尾页");
		} else {
			buffer.append("<a href=\"index/article.action?number=" + (maxPage - 1) + "\">尾页</a>");
		}
		html = buffer.toString();
		this.getRequest().setAttribute("html", html);
		this.getRequest().setAttribute("articleList", articleList);
		return "users/article";
	}

	// 阅读公告
	@RequestMapping("read.action")
	public String read(String id) {
		this.front();
		Article article = this.articleService.getArticleById(id);
		article.setHits("" + (Integer.parseInt(article.getHits()) + 1));
		this.articleService.updateArticle(article);
		this.getRequest().setAttribute("article", article);
		return "users/read";
	}

	// 准备登录
	@RequestMapping("preLogin.action")
	public String prelogin() {
		this.front();
		return "users/login";
	}

	// 用户登录
	@RequestMapping("login.action")
	public String login() {
		this.front();
		String username = this.getRequest().getParameter("username");
		String password = this.getRequest().getParameter("password");
		Users u = new Users();
		u.setUsername(username);
		List<Users> usersList = this.usersService.getUsersByCond(u);
		if (usersList.size() == 0) {
			this.getSession().setAttribute("message", "用户名不存在");
			return "redirect:/index/preLogin.action";
	}

}

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/topic" , produces = "text/plain;charset=utf-8")
public class TopicAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private TopicService topicService;
	@Autowired
	@Resource
	private UsersService usersService;
	@Autowired
	@Resource
	private JiancaiService jiancaiService;

	// 准备添加数据
	@RequestMapping("createTopic.action")
	public String createTopic() {
		List<Users> usersList = this.usersService.getAllUsers();
		this.getRequest().setAttribute("usersList", usersList);
		List<Jiancai> jiancaiList = this.jiancaiService.getAllJiancai();
		this.getRequest().setAttribute("jiancaiList", jiancaiList);
		return "admin/addtopic";
	}
	// 添加数据
	@RequestMapping("addTopic.action")
	public String addTopic(Topic topic) {
		this.topicService.insertTopic(topic);
		return "redirect:/topic/createTopic.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteTopic.action")
	public String deleteTopic(String id) {
		String action = "getAll" + name2 + ".action";
		if (method != null) {
			action = "query" + name2 + "ByCond.action";
		}

		List<Object> objList = new ArrayList<Object>();
		if (nameList != null && valueList != null) {
			for (int i = 0; i < nameList.size(); i++) {
				path += "&" + nameList.get(i) + "=" + valueList.get(i);
			}
		}
		int pageNumber = list.size();
		int maxPage = pageNumber;
		if (maxPage % 10 == 0) {
			maxPage = maxPage / 10;
		} else {
			maxPage = maxPage / 10 + 1;
		}
		if (number == null) {
			number = "0";
		}
		int start = Integer.parseInt(number) * 10;
		int over = (Integer.parseInt(number) + 1) * 10;
		int count = pageNumber - over;
		if (count <= 0) {
			over = pageNumber;
		}
		for (int i = start; i < over; i++) {
			Object obj = list.get(i);
			objList.add(obj);
		}
		buffer.append("&nbsp;&nbsp;共为");
		buffer.append(maxPage);
		buffer.append("页&nbsp; 共有");
		buffer.append(pageNumber);
		buffer.append("条&nbsp; 当前为第");
		buffer.append((Integer.parseInt(number) + 1));
		buffer.append("页 &nbsp;");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("首页");
		} else {
			buffer.append("<a href=\"" + name + "/" + action + "?number=0" + path + "\">首页</a>");
		}
		buffer.append("&nbsp;&nbsp;");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("上一页");
		} else {
			buffer.append("<a href=\"" + name + "/" + action + "?number=" + (Integer.parseInt(number) - 1) + "" + path + "\">上一页</a>");
		}
		buffer.append("&nbsp;&nbsp;");
		if (maxPage <= (Integer.parseInt(number) + 1)) {
			buffer.append("下一页");
	public String updatePeihuo(Peihuo peihuo) {
		this.peihuoService.updatePeihuo(peihuo);
		return "redirect:/peihuo/getAllPeihuo.action";
	}

	// 显示全部数据
		@RequestMapping("getAllPeihuo.action")
		public String getAllPeihuo(String number) {
			List<Peihuo> peihuoList = this.peihuoService.getAllPeihuo();
			PageHelper.getPage(peihuoList, "peihuo", null, null, 10, number, this.getRequest(), null);
			return "admin/listpeihuo";
		}
		
		// 显示全部数据
		@RequestMapping("getNetWork.action")
		public String getNetWork(String number) {
			List<Peihuo> peihuoList = this.peihuoService.getAllPeihuo();
			PageHelper.getPage(peihuoList, "peihuo", null, null, 10, number, this.getRequest(), null);
			
			return "users/network";
		}

	// 按条件查询数据 (模糊查询)
	@RequestMapping("queryPeihuoByCond.action")
	public String queryPeihuoByCond(String cond, String name, String number) {
		Peihuo peihuo = new Peihuo();
		if (cond != null) {
			if ("peihuoname".equals(cond)) {
				peihuo.setPeihuoname(name);
			}
			if ("cityid".equals(cond)) {
				peihuo.setCityname(name);
			}
			if ("address".equals(cond)) {
				peihuo.setAddress(name);
			}
			if ("contact".equals(cond)) {
				peihuo.setContact(name);
			}
			if ("memo".equals(cond)) {
				peihuo.setMemo(name);
			}
		}

		List<String> nameList = new ArrayList<String>();
		List<String> valueList = new ArrayList<String>();
		nameList.add(cond);
		valueList.add(name);
		PageHelper.getPage(this.peihuoService.getPeihuoByLike(peihuo), "peihuo", nameList, valueList, 10, number, this.getRequest(), "query");
		name = null;
			this.ordersService.insertOrders(orders);
		}
		return "redirect:/index/showOrders.action";
	}

	// 查看订购
	@RequestMapping("showOrders.action")
	public String showOrders(String number) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Orders orders = new Orders();
		orders.setUsersid(userid);
		List<Orders> ordersList = new ArrayList<Orders>();
		List<Orders> tempList = this.ordersService.getOrdersByCond(orders);
		int pageNumber = tempList.size();
		int maxPage = pageNumber;
		if (maxPage % 12 == 0) {
			maxPage = maxPage / 12;
		} else {
			maxPage = maxPage / 12 + 1;
		}
		if (number == null) {
			number = "0";
		}
		int start = Integer.parseInt(number) * 12;
		int over = (Integer.parseInt(number) + 1) * 12;
		int count = pageNumber - over;
		if (count <= 0) {
			over = pageNumber;
		}
		for (int i = start; i < over; i++) {
			Orders o = tempList.get(i);
			ordersList.add(o);
		}
		String html = "";
		StringBuffer buffer = new StringBuffer();
		buffer.append("&nbsp;&nbsp;共为");
		buffer.append(maxPage);
		buffer.append("页&nbsp; 共有");
		buffer.append(pageNumber);
		buffer.append("条&nbsp; 当前为第");
		buffer.append((Integer.parseInt(number) + 1));
		buffer.append("页 &nbsp;");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("首页");
		StringBuffer buffer = new StringBuffer();
		buffer.append("&nbsp;&nbsp;共为");
		buffer.append(maxPage);
		buffer.append("页&nbsp; 共有");
		buffer.append(pageNumber);
		buffer.append("条&nbsp; 当前为第");
		buffer.append((Integer.parseInt(number) + 1));
		buffer.append("页 &nbsp;");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("首页");
		} else {
			buffer.append("<a href=\"index/showOrders.action?number=0\">首页</a>");
		}
		buffer.append("&nbsp;&nbsp;");
		if ((Integer.parseInt(number) + 1) == 1) {
			buffer.append("上一页");
		} else {
			buffer.append("<a href=\"index/showOrders.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");
		}
		buffer.append("&nbsp;&nbsp;");
		if (maxPage <= (Integer.parseInt(number) + 1)) {
			buffer.append("下一页");
		} else {
			buffer.append("<a href=\"index/showOrders.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");
		}
		buffer.append("&nbsp;&nbsp;");
		if (maxPage <= (Integer.parseInt(number) + 1)) {
			buffer.append("尾页");
		} else {
			buffer.append("<a href=\"index/showOrders.action?number=" + (maxPage - 1) + "\">尾页</a>");
		}
		html = buffer.toString();
		this.getRequest().setAttribute("html", html);
		this.getRequest().setAttribute("ordersList", ordersList);
		return "users/orderlist";
	}

	// 准备付款
	@RequestMapping("prePay.action")
	public String prePay(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		this.getRequest().setAttribute("id", id);
		return "users/pay";
	}

		this.adminService = adminService;
	}

}

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/details", produces = "text/plain;charset=utf-8")
public class DetailsAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
	@Resource
	private DetailsService detailsService;
	@Autowired
	@Resource
	private JiancaiService jiancaiService;
	@Autowired
	@Resource
	private CityService cityService;
	@Autowired
	@Resource
	private PeihuoService peihuoService;

	// 准备添加数据
	@RequestMapping("createDetails.action")
	public String createDetails() {
		List<Jiancai> jiancaiList = this.jiancaiService.getAllJiancai();
		this.getRequest().setAttribute("jiancaiList", jiancaiList);
		List<City> cityList = this.cityService.getAllCity();
		this.getRequest().setAttribute("cityList", cityList);
		List<Peihuo> peihuoList = this.peihuoService.getAllPeihuo();
		this.getRequest().setAttribute("peihuoList", peihuoList);
		return "admin/adddetails";
		PageHelper.getPage(this.topicService.getTopicByLike(topic), "topic", nameList, valueList, 10, number, this.getRequest(), "query");
		name = null;
		cond = null;
		return "admin/querytopic";
	}

	// 按主键查询数据
	@RequestMapping("getTopicById.action")
	public String getTopicById(String id ) {
		Topic topic = this.topicService.getTopicById(id);
		this.getRequest().setAttribute("topic", topic);
		List<Users> usersList = this.usersService.getAllUsers();
		this.getRequest().setAttribute("usersList", usersList);
		List<Jiancai> jiancaiList = this.jiancaiService.getAllJiancai();
		this.getRequest().setAttribute("jiancaiList", jiancaiList);
		return "admin/edittopic";
	}

	public TopicService getTopicService() { return topicService; }

	public void setTopicService(TopicService topicService) { this.topicService = topicService; }

}

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/cart", produces = "text/plain;charset=utf-8")
public class CartAction extends BaseAction {
	// 注入Service 由于标签的存在 所以不需要getter setter
	@Autowired
		this.getRequest().setAttribute("ordersList", ordersList);
		return "users/orderlist";
	}

	// 准备付款
	@RequestMapping("prePay.action")
	public String prePay(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		this.getRequest().setAttribute("id", id);
		return "users/pay";
	}

	// 付款
	@RequestMapping("pay.action")
	public String pay(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));
		orders.setStatus("已付款");
		this.ordersService.updateOrders(orders);
		return "redirect:/index/showOrders.action";
	}

	// 确认收货
	@RequestMapping("over.action")
	public String over(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));
		orders.setStatus("已收货");
		this.ordersService.updateOrders(orders);
		return "redirect:/index/showOrders.action";
	}

	// 取消订单
	@RequestMapping("cancel.action")
	public String cancel(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));
		orders.setStatus("已取消");
		this.ordersService.updateOrders(orders);
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		return "users/editpwd";
	}

	// 修改密码
	@RequestMapping("editpwd.action")
	public String editpwd() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		String password = this.getRequest().getParameter("password");
		String repassword = this.getRequest().getParameter("repassword");
		Users users = this.usersService.getUsersById(userid);
		if (password.equals(users.getPassword())) {
			users.setPassword(repassword);
			this.usersService.updateUsers(users);
		} else {
			this.getSession().setAttribute("message", "旧密码错误");
			return "redirect:/index/prePwd.action";
		}
		return "redirect:/index/prePwd.action";
	}

	@RequestMapping("usercenter.action")
	public String usercenter() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		return "users/usercenter";
	}

	@RequestMapping("userinfo.action")
	public String userinfo() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		this.getSession().setAttribute("users", this.usersService.getUsersById(userid));
	public String deletecart(String id) {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		this.cartService.deleteCart(id);
		return "redirect:/index/cart.action";
	}

	// 准备结算
	@RequestMapping("preCheckout.action")
	public String preCheckout() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Cart cart = new Cart();
		cart.setUsersid(userid);
		List<Cart> cartList = this.cartService.getCartByCond(cart);
		if (cartList.size() == 0) {
			this.getRequest().setAttribute("message", "请选购果蔬商品");
			return "redirect:/index/cart.action";
		}
		List<City> cityList = this.cityService.getAllCity();
		this.getRequest().setAttribute("cityList", cityList);
		return "users/checkout";
	}

	// 结算
	@RequestMapping("checkout.action")
	public String checkout() {
		this.front();
		if (this.getSession().getAttribute("userid") == null) {
			return "redirect:/index/preLogin.action";
		}
		String userid = (String) this.getSession().getAttribute("userid");
		Cart cart1 = new Cart();
		cart1.setUsersid(userid);
		List<Cart> cartList = this.cartService.getCartByCond(cart1);
		if (cartList.size() == 0) {
			this.getRequest().setAttribute("message", "请选购果蔬商品");
			return "redirect:/index/cart.action";
		} else {
		json.accumulate("result", success);
		System.out.println(json.toString());
		out.println(json.toString());
		out.flush();
		out.close();
	}
}

//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/ajax", produces = "text/plain;charset=utf-8")
public class AjaxAction extends BaseAction {

	@Autowired
	@Resource
	private PeihuoService peihuoService;

	// 准备添加数据
	@RequestMapping("getPeihuo.action")
	@ResponseBody
	public String getPeihuo() throws JSONException {
		String cityid = this.getRequest().getParameter("cityid");
		Peihuo peihuo = new Peihuo();
		peihuo.setCityid(cityid);
		List<Peihuo> peihuoList = this.peihuoService.getPeihuoByCond(peihuo);
		JSONArray peihuoid = new JSONArray(); // 存放ID
		JSONArray peihuoname = new JSONArray(); // 存放名称
		for (Peihuo c : peihuoList) {
			peihuoid.put(c.getPeihuoid());
			peihuoname.put(c.getPeihuoname());
		}
		JSONObject json = new JSONObject();
	}

	// 批量删除数据
	@RequestMapping("deleteJiancaiByIds.action")
	public String deleteJiancaiByIds() {
		String[] ids = this.getRequest().getParameterValues("jiancaiid");
		for (String jiancaiid : ids) {
			this.jiancaiService.deleteJiancai(jiancaiid);
		}
		return "redirect:/jiancai/getAllJiancai.action";
	}

	// 更新数据
	@RequestMapping("updateJiancai.action")
	public String updateJiancai(Jiancai jiancai) {
		this.jiancaiService.updateJiancai(jiancai);
		return "redirect:/jiancai/getAllJiancai.action";
	}

	// 显示全部数据
	@RequestMapping("getAllJiancai.action")
	public String getAllJiancai(String number) {
		List<Jiancai> jiancaiList = this.jiancaiService.getAllJiancai();
		PageHelper.getPage(jiancaiList, "jiancai", null, null, 10, number, this.getRequest(), null);
		return "admin/listjiancai";
	}

	// 按条件查询数据 (模糊查询)
	@RequestMapping("queryJiancaiByCond.action")
	public String queryJiancaiByCond(String cond, String name, String number) {
		Jiancai jiancai = new Jiancai();
		if (cond != null) {
			if ("jiancainame".equals(cond)) {
				jiancai.setJiancainame(name);
			}
			if ("image".equals(cond)) {
				jiancai.setImage(name);
			}
			if ("cateid".equals(cond)) {
				jiancai.setCatename(name);
			}
			if ("price".equals(cond)) {
				jiancai.setPrice(name);
			}
			if ("recommend".equals(cond)) {
				jiancai.setRecommend(name);
			}
			if ("thestart".equals(cond)) {
				jiancai.setThestart(name);
			}
			if ("theend".equals(cond)) {
		return "admin/index";
	}

	// 准备添加数据
	@RequestMapping("createAdmin.action")
	public String createAdmin() {
		return "admin/addadmin";
	}

	// 添加数据
	@RequestMapping("addAdmin.action")
	public String addAdmin(Admin admin) {
		admin.setAddtime(VeDate.getStringDateShort());
		this.adminService.insertAdmin(admin);
		return "redirect:/admin/createAdmin.action";
	}

	// 通过主键删除数据
	@RequestMapping("deleteAdmin.action")
	public String deleteAdmin(String id) {
		this.adminService.deleteAdmin(id);
		return "redirect:/admin/getAllAdmin.action";
	}

	// 批量删除数据
	@RequestMapping("deleteAdminByIds.action")
	public String deleteAdminByIds() {
		String[] ids = this.getRequest().getParameterValues("adminid");
		for (String adminid : ids) {
			this.adminService.deleteAdmin(adminid);
		}
		return "redirect:/admin/getAllAdmin.action";
	}

	// 更新数据
	@RequestMapping("updateAdmin.action")
	public String updateAdmin(Admin admin) {
		this.adminService.updateAdmin(admin);
		return "redirect:/admin/getAllAdmin.action";
	}

	// 显示全部数据
	@RequestMapping("getAllAdmin.action")
	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";
	}

				details.setPrice(name);
			}
			if ("cityid".equals(cond)) {
				details.setCityid(name);
			}
			if ("peihuoid".equals(cond)) {
				details.setPeihuoid(name);
			}
			if ("viewdate".equals(cond)) {
				details.setViewdate(name);
			}
		}

		List<String> nameList = new ArrayList<String>();
		List<String> valueList = new ArrayList<String>();
		nameList.add(cond);
		valueList.add(name);
		PageHelper.getPage(this.detailsService.getDetailsByLike(details), "details", nameList, valueList, 10, number, this.getRequest(),
				"query");
		name = null;
		cond = null;
		return "admin/querydetails";
	}

	// 按主键查询数据
	@RequestMapping("getDetailsById.action")
	public String getDetailsById(String id) {
		Details details = this.detailsService.getDetailsById(id);
		this.getRequest().setAttribute("details", details);
		List<Jiancai> jiancaiList = this.jiancaiService.getAllJiancai();
		this.getRequest().setAttribute("jiancaiList", jiancaiList);
		List<City> cityList = this.cityService.getAllCity();
		this.getRequest().setAttribute("cityList", cityList);
		List<Peihuo> peihuoList = this.peihuoService.getAllPeihuo();
		this.getRequest().setAttribute("peihuoList", peihuoList);
		return "admin/editdetails";
	}

	public DetailsService getDetailsService() {
		return detailsService;
	}

	public void setDetailsService(DetailsService detailsService) {
		this.detailsService = detailsService;
	}

}

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐