Java项目:SSH电影订票管理系统

114 篇文章 4 订阅
111 篇文章 0 订阅

作者主页:夜未央5788

 简介:Java领域优质创作者、Java项目、学习资料、技术互助

文末获取源码

项目介绍

本项目分为前后台,前台用户角色登录,后台管理员角色登录;
用户角色主要功能:
用户页面买票界面,用户页面用户登录页面,用户页面用户页面,用户页面购票,用户页面选票界面

管理员角色主要功能:
管理员角色修改场次,管理员角色后台登录页面,管理员角色场次增删改查,管理员角色影片管理,管理员角色用户增删改查,管理员角色管理员增删改查,管理员角色订单搜索等。

由于本程序规模不大,可供课程设计,毕业设计学习演示之用

环境需要

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+hibernate+struts 2

2. 前端:JSP+CSS+JavaScript+jquery

使用说明

1.使用Navicat或者其它工具,在mysql中创建对应sql文件名称的数据库,并导入项目的sql文件;
2. 使用IDEA/Eclipse/MyEclipse导入项目;
3. 将项目中application.yml配置文件中的数据库配置改为自己的配置;
4. 运行项目,在浏览器中输入http://localhost:8080/TianRen 登录
管理员:admin/admin
用户:123456@qq.com / 123456

运行截图

 管理端页面

相关代码 

用户管理控制器

@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private TUserinfoService tUserinfoService;
    @RequestMapping("/find")
    public String findme(ModelMap modelMap){
        String name = SecurityContextHolder.getContext().getAuthentication().getName();
        TUserinfo userByname = tUserinfoService.findUserByname(name);
        modelMap.addAttribute("me",userByname);
        return "user";
    }
    @RequestMapping("/update")
    public String update(TUserinfo tUserinfo){
        System.out.println(tUserinfo);
        tUserinfoService.update(tUserinfo);
        return "redirect:/user/find";
    }

    @RequestMapping("/registered")
    public String registered(TUserinfo tUserinfo){
        System.out.println(tUserinfo);
        tUserinfoService.registered(tUserinfo);
        return "redirect:/login";
    }
}

电影管理控制器

@Controller
@RequestMapping("/movies")
public class UserMovieController {
    @Autowired
    private TMovieService tMovieService;
    @Autowired
    private TSortService tSortService;
    @Autowired
    private TCommentService tCommentService;


    /**
     * 首页
     */
    @RequestMapping("/home")
    public String home(ModelMap modelMap) {
        List<TMovie> movieList = new ArrayList<>();
        List<TMovie> movieList2 = new ArrayList<>();
        List<TMovie> movieList3 = new ArrayList<>();
        List<TMovie> movies = tMovieService.tMovieTop();
        List<TMovie> bysort1 = tMovieService.findBysort(1);
        for (int i = 0; i < 4; i++) {
            TMovie tMovie = bysort1.get(i);
            movieList.add(tMovie);
        }

        List<TMovie> bysort2 = tMovieService.findBysort(2);
        for (int i = 0; i < 8; i++) {
            TMovie tMovie = bysort2.get(i);
            movieList2.add(tMovie);
        }

        List<TMovie> findall = tMovieService.findall();
        for (int i = 0; i < 6; i++) {
            TMovie tMovie = findall.get(i);
            movieList3.add(tMovie);
        }

        List<TMovie> topBysortl = tMovieService.findTopBysort(1, 0, 5);
        List<TMovie> topBysortr = tMovieService.findTopBysort(1, 5, 5);
        List<TMovie> topBysortl1 = tMovieService.findTopBysort(2, 0, 5);
        List<TMovie> topBysortr1 = tMovieService.findTopBysort(2, 5, 5);

        modelMap.addAttribute("movies", movies);

        modelMap.addAttribute("comedy", movieList);
        modelMap.addAttribute("l", topBysortl);
        modelMap.addAttribute("r", topBysortr);

        modelMap.addAttribute("actions", movieList2);
        modelMap.addAttribute("l1", topBysortl1);
        modelMap.addAttribute("r1", topBysortr1);

        modelMap.addAttribute("all", movieList3);
        return "movies_home";
    }


    /**
     * 分类查询
     */
    @RequestMapping("/findBys")
    public String findByS(Integer sid,Integer page,Integer pageSize,ModelMap modelMap){
        List<TSort> all = tSortService.findAll(null);
        if (sid==0){
            List<TMovie> findall = tMovieService.findall(page, pageSize);
            PageInfo<TMovie> pageInfo=new PageInfo<>(findall);
            Integer count = tMovieService.findCount();
            Page page1=new Page(pageSize,page,count);
            modelMap.addAttribute("movies",pageInfo);
            modelMap.addAttribute("pages",page1);
        }else {
            List<TMovie> bysort = tMovieService.findBysort(sid, page, pageSize);
            Integer integer = tMovieService.countSort(sid);
            PageInfo<TMovie> pageInfo=new PageInfo<>(bysort);
            Page page1=new Page(pageSize,page,integer);
            modelMap.addAttribute("movies",pageInfo);
            modelMap.addAttribute("pages",page1);
        }
        modelMap.addAttribute("sortid",sid);
        modelMap.addAttribute("sorts",all);
        return "movies_more";
    }
    /**
     *
     * @param id 分类ID
     * @param modelMap 视图
     * @return 
     */
    @RequestMapping("/findBySort")
    public String findBySort(@RequestParam(value = "sid", required = true) Integer id, ModelMap modelMap) {
        List<TSort> all = tSortService.findAll(null);
        List<TMovie> bySortID = tMovieService.findBySortID(id);
        PageInfo pageInfo = new PageInfo(bySortID);
        modelMap.addAttribute("movies", pageInfo);
        modelMap.addAttribute("sorts", all);
        return "movie_list";
    }

    /**
     * @param id       电影ID
     * @param modelMap 视图
     * @return 点击的电影显示电影内容和评论信息
     */
    @RequestMapping("/findById")
    public String findById(@RequestParam(value = "id", required = true) Integer id, ModelMap modelMap) {
        TMovie tMovie = tMovieService.queryById(id);
        tMovie.setHit(tMovie.getHit() + 1);
        tMovieService.update(tMovie);
        TComment t = new TComment();
        t.setMovieobj(id);
        List<TComment> findall = tCommentService.findall(t);
        modelMap.addAttribute("movie", tMovie);
        modelMap.addAttribute("comments", findall);
        return "movie_detils";
    }

    /**
     * 电影名字模糊查询
     */
    @RequestMapping("/findByname")
    public String findByname(String name, ModelMap modelMap,
                             @RequestParam(value = "page", required = true) Integer page,
                             @RequestParam(value = "pagesize", required = true) Integer pagesize) {
        List<TMovie> movies = tMovieService.findBYname(name, page, pagesize);
        PageInfo pageInfo = new PageInfo(movies);
        modelMap.addAttribute("movies", pageInfo);
        return "movies_more";
    }

}

如果也想学习本系统,下面领取。关注并回复:044ssh

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜未央5788

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值