源码获取:俺的博客首页 "资源" 里下载!
项目介绍
本项目分为前台与后台,前台为游客浏览,后台为管理员管理;
管理员角色包含以下功能:
管理员登录,管留言信息修改,景点管理,资讯管理,图片库管理,留言管理,管理员管理等功能。
用户角色包含以下功能:
用户首页,景点介绍,人文地理,地区资讯,留言等功能。
环境需要
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项目:否;
技术栈
SSM+Ajax+CSS+JavaScript+BootStrap+jQuery+mysql
使用说明
1. 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;
若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行;






酒店信息控制层:
/**
* @Author: yy
* @Description: TODO(酒店信息)
*/
@Controller
@RequestMapping("/hotels")
public class HotelController {
@Autowired
private IHotelService hotelService;
@Autowired
private IUserService iUserService;
//根据hid查看已拥有的房型
@RequestMapping("/findRooms.do")
public ModelAndView findRooms(Integer hid)throws Exception{
ModelAndView mv = new ModelAndView();
List<Hoteldetail> list = hotelService.findDetail(hid);
mv.addObject("room",list);
mv.setViewName("hotel-room-remove");
return mv;
}
//移除已拥有的房型
@RequestMapping("/removeRoom.do")
public String removeRoom(@RequestParam(name = "hid") Integer hid, @RequestParam(name = "ids") int[] ids)throws Exception{
hotelService.removeRoom(hid,ids);
return "redirect:findAll.do";
}
//根据hid查看未拥有的房型
@RequestMapping("/findOtherRooms.do")
public ModelAndView findOtherRooms(Integer hid)throws Exception{
ModelAndView mv = new ModelAndView();
Hotel hotel = hotelService.findByHid(hid);
mv.addObject("hotel",hotel);
List<Hoteltype> list = hotelService.findOtherRooms(hid);
mv.addObject("room",list);
mv.setViewName("hotel-room-add");
return mv;
}
//添加未拥有的房型
@RequestMapping("/addRoom.do")
public String addRoom(@RequestParam(name = "hid") Integer hid, @RequestParam(name = "ids") int[] ids,@RequestParam(name = "prices")String[] prices)throws Exception{
List list = new ArrayList();
for (int i=0;i<prices.length;i++) {
if (prices[i]!=""){
list.add(Double.valueOf(prices[i]));
}
}
if (ids.length==list.size()){
hotelService.addRoom(hid,ids,list);
}
return "redirect:findAll.do";
}
//查看酒店房型详情
@RequestMapping("/findByUid.do")
public ModelAndView findByUid(Integer hid)throws Exception{
ModelAndView mv = new ModelAndView();
Hotel hotel = hotelService.findByHid(hid);
mv.addObject("hotel",hotel);
List<Hoteldetail> hoteldetail = hotelService.findDetail(hid);
mv.addObject("details",hoteldetail);
mv.setViewName("hotel-detail");
return mv;
}
//新增酒店
@RequestMapping("/findUsers.do")
public ModelAndView findUsers() throws Exception{
List<User> list = hotelService.findUsers();
ModelAndView mv = new ModelAndView();
mv.addObject("users",list);
mv.setViewName("hotel-add");
return mv;
}
@RequestMapping("/save.do")
public String save(Hotel hotel) throws Exception{
if (hotel.getHimageFile()!=null){
String filename = Upload.uploadImg(HIMAGE,hotel.getHimageFile());
hotel.setHimage("img/hotel/"+filename);
hotelService.save(hotel);
}
return "redirect:findAll.do";
}
//删除酒店
@RequestMapping("/delete.do")
public String delete(Integer hid) throws Exception {
hotelService.delete(hid);
return "redirect:findAll.do";
}
//修改酒店信息
@RequestMapping("/findU.do")
public ModelAndView findU(Integer hid) throws Exception{
ModelAndView mv = new ModelAndView();
Hotel hotel = hotelService.findByHid(hid);
mv.addObject("hotel",hotel);
List<User> list = iUserService.findAll(1,100,"%%");
mv.addObject("UList",list);
mv.setViewName("hotel-update");
return mv;
}
@RequestMapping("/update.do")
public String update(Hotel hotel) throws Exception{
if (hotel.getHimageFile().getSize()!=0&&hotel.getHimageFile()!=null){//修改过图片
String filename = Upload.uploadImg(HIMAGE,hotel.getHimageFile());
hotel.setHimage("img/hotel/"+filename);
hotelService.update(hotel);
}else{//未修改图片
hotelService.update(hotel);
}
return "redirect:findAll.do";
}
//查询所有订单
@RequestMapping("/findAll.do")
public ModelAndView findAll(
@RequestParam(name = "page",defaultValue = "1")Integer page,
@RequestParam(name = "size",defaultValue = "10")Integer size,
@RequestParam(name = "search",defaultValue = "")String search
) throws Exception{
ModelAndView mv = new ModelAndView();
List<Hotel> list = hotelService.findAll(page,size,"%"+search+"%");
PageInfo pageInfo = new PageInfo(list);
mv.addObject("pageInfo",pageInfo);
mv.setViewName("hotel-list");
return mv;
}
}
景点分类控制层:
/**
* @Author: yy
* @Description: TODO(景点分类)
*/
@Controller
@RequestMapping("/cates")
public class CategoryController {
@Autowired
private ICategoryService categoryService;
//新增分类
@RequestMapping("/save.do")
@PreAuthorize("hasAnyAuthority('/cates/save.do')")
public String save(Category category) throws Exception{
categoryService.save(category);
return "redirect:findAll.do";
}
//删除分类
@RequestMapping("/delete.do")
@PreAuthorize("hasAnyAuthority('/cates/delete.do')")
public String delete(Integer cid) throws Exception{
categoryService.delete(cid);
return "redirect:findAll.do";
}
//修改分类
@RequestMapping("/update.do")
public String update(Category category) throws Exception{
categoryService.update(category);
return "redirect:findAll.do";
}
//根据cid查询
@RequestMapping("/findByCid.do")
public ModelAndView findByCid(Integer cid) throws Exception {
ModelAndView mv = new ModelAndView();
Category cate = categoryService.findByCid(cid);
mv.addObject("cateInfo",cate);
mv.setViewName("cate-update");
return mv;
}
//查询所有线路分类
@RequestMapping("/findAll.do")
public ModelAndView findAll(
@RequestParam(name="page",required = true, defaultValue = "1") Integer page,
@RequestParam(name="size",required = true, defaultValue = "10") Integer size,
@RequestParam(name="cname",required = true, defaultValue = "") String cname
) throws Exception{
ModelAndView mv = new ModelAndView();
List<Category> list = categoryService.findAll(page,size,"%"+cname+"%");
PageInfo pageInfo = new PageInfo(list);
mv.addObject("pageInfo",pageInfo);
mv.setViewName("cate-list");
return mv;
}
}
订单信息控制层:
/**
* @Author: yy
* @Description: TODO(订单信息)
*/
@Controller
@RequestMapping("/orders")
public class OrderController {
@Autowired
private IOrderService orderService;
//删除酒店订单
@RequestMapping("/delete.do")
@PreAuthorize("hasAnyAuthority('/orders/delete.do')")
public String delete(Integer id) throws Exception{
orderService.delete(id);
return "redirect:findAll.do";
}
//删除景点订单
@RequestMapping("/deleteRoute.do")
@PreAuthorize("hasAnyAuthority('/orders/deleteRoute.do')")
public String deleteRoute(Integer id) throws Exception{
orderService.deleteRoute(id);
return "redirect:findAllRoute.do";
}
//查询所有景点订单
@RequestMapping("/findAllRoute.do")
public ModelAndView findAllRoute(
@RequestParam(name = "page",defaultValue = "1")Integer page,
@RequestParam(name = "size",defaultValue = "7")Integer size,
@RequestParam(name = "search",defaultValue = "")String search
) throws Exception{
ModelAndView mv = new ModelAndView();
List<RouteOrder> list = orderService.findAllRoute(page,size,"%"+search+"%");
PageInfo pageInfo = new PageInfo(list);
mv.addObject("pageInfo",pageInfo);
mv.setViewName("rorder-list");
return mv;
}
//查询所有酒店订单
@RequestMapping("/findAll.do")
@PreAuthorize("hasAnyAuthority('/orders/findAll.do')")
public ModelAndView findAll(
@RequestParam(name = "page",defaultValue = "1")Integer page,
@RequestParam(name = "size",defaultValue = "7")Integer size,
@RequestParam(name = "search",defaultValue = "")String search
) throws Exception{
ModelAndView mv = new ModelAndView();
List<Order> list = orderService.findAll(page,size,"%"+search+"%");
PageInfo pageInfo = new PageInfo(list);
mv.addObject("pageInfo",pageInfo);
mv.setViewName("order-list");
return mv;
}
}
源码获取:俺的博客首页 "资源" 里下载!
该项目是一个基于SSM框架的系统,包括酒店信息管理、景点分类管理和订单信息管理。管理员可以进行各类操作,如添加、删除和更新数据。用户则能浏览相关信息。项目需要Java环境、Tomcat服务器以及MySQL数据库支持。源代码可在作者博客的资源部分下载。

被折叠的 条评论
为什么被折叠?



