基于javaweb+jsp的在线旅游系统(java+jsp+SSM+Spring+mysql+maven)

这是一个基于JavaWeb、JSP、SSM(Spring、SpringMVC、MyBatis)和MySQL的在线旅游系统项目。系统提供用户登录注册、景点展示、旅游预订、收藏和购买等功能,同时包含后台管理员的订单、景点、留言、分类和系统管理模块。适用于课程设计、大作业、毕业设计和项目练习等场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

基于javaweb+jsp的在线旅游系统(java+jsp+SSM+Spring+mysql+maven)

一、项目简述

功能:用户的登录注册,旅游景点的展示,旅游预订,收藏,购买,以及酒店住宿留言等等,后台管理员,订单管理,景点管理,留言管理,分类管理吗,以及系统管理等等。
二、项目运行
环境配置:

Jdk1.8 + Tomcat8.5 + mysql + Idea2019(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

JSP +Spring + SpringMVC + MyBatis + html+ css + JavaScript + JQuery + Ajax + layui+ maven等等

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

适用

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

            @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(订单信息)
}
景点分类控制层:
/**
 * @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";
    }
        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);
        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");
            @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(景点分类)
        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;
    }
        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 {
    @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;
    }
        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{
        return mv;
    }
酒店信息控制层:
/**
 * @Author: yy
 * @Description: TODO(酒店信息)
 */
@Controller
@RequestMapping("/hotels")
public class HotelController {
    @Autowired
    private IHotelService hotelService;
    @Autowired
    private IUserService iUserService;
    //根据hid查看已拥有的房型
        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();
    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";
    }
 * @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);
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{
        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;
    }
酒店信息控制层:
/**
        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]));
        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{
    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{//未修改图片
@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: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{
        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{
 * @Description: TODO(酒店信息)
 */
@Controller
@RequestMapping("/hotels")
public class HotelController {
    @Autowired
    private IHotelService hotelService;
    @Autowired
    private IUserService iUserService;
    //根据hid查看已拥有的房型
        mv.setViewName("order-list");
        return mv;
    }
酒店信息控制层:
/**
 * @Author: yy
 * @Description: TODO(酒店信息)
 */
@Controller
@RequestMapping("/hotels")
public class HotelController {
    @Autowired
    private IHotelService hotelService;
    @Autowired
    private IUserService iUserService;
    //根据hid查看已拥有的房型
        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;
    }
酒店信息控制层:
/**
 * @Author: yy
 * @Description: TODO(酒店信息)
 */
@Controller
@RequestMapping("/hotels")
public class HotelController {
    @Autowired
    @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查看未拥有的房型
    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;
    }
        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();
    @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,
    //新增酒店
    @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")

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值