随着消费水平的不断提高,人们的消费重心逐渐偏向于精神享受方面,去影院观看最新上映的电影也成为了一种潮流时尚,像蜘蛛网、百度糯米,万达电影等影院购票网站成为了另一个开发热点。本文对电影、影院管理、电影排片,用户选座购票业务进行了研究,使用SSM框架搭建开发环境和 MYSQL数据库,通过Navicat Premium软件连接并管理数据库;运用JSEE、SQL、Js,CSS语言和开源前端框架Amaze UI进行开发。系统实现了管理电影、影院、放映厅、放映记录、地区,影片类别信息的基本功能,以及前台用户注册登录、浏览影院、影片信息,选座购票功能。用户就不用去影院购买电影票,可以直接在网上进行选座购买,减少了传统影院的售票程序,避免了人工售票的繁琐工序,优化了用户体验。
关键字: 电影购票系统、SSM、MySQL、Js、CSS
电影类别管理:可以进行修改相关电影类别
电影信息管理:可以进行修改相关电影信息内容
放映大厅管理:可以进行大厅增删查改信息
订单管理:可查看用户下单订单详情、、、、、、、
登录后可以首页查看电影详情、热播推荐等页面下单购票、、、、、、
Jdk1.8、Tomcat、MySQL、Eclipse(Idea)
JSP、Spring、SpringMVC 、MyBatis 、html、css 、JavaScript 、JQuery 、Ajax 、maven等
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<!--指定扫描包-->
<context:component-scan base-package="com.mecol.film"/>
<!--配置数据源-->
<!--配置c3p0数据源-->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<!--注入四个数据库原属性-->
<property name="driverClass" value="com.mysql.cj.jdbc.Driver"></property>
<property name="jdbcUrl" value="jdbc:mysql://127.0.0.1:3306/film?characterEncoding=utf8&useSSL=false&serverTimezone=CTT"></property>
<property name="user" value="root"></property>
<property name="password" value="123456"></property>
</bean>
<!--添加事务支持-->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<!--开启事务注解-->
<tx:annotation-driven transaction-manager="txManager"/>
<!--配置Mybatis工厂,同时指定数据源,并与Mybatis完美整合-->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configLocation" value="classpath:mybatis-config.xml"/>
</bean>
<!--mapper代理开发使用Spring自动扫描Mybatis接口并装配(@Mapper)-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!--mybatis-spring组件扫描器-->
<property name="basePackage" value="com.mecol.film.mapper"/>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"/>
</bean>
</beans>
package com.mecol.film.controller;
import com.mecol.film.entity.Admin;
import com.mecol.film.entity.FilmCategory;
import com.mecol.film.entity.Play;
import com.mecol.film.entity.Ticket;
import com.mecol.film.pojo.DeleteAndUp;
import com.mecol.film.pojo.FilmPojo;
import com.mecol.film.pojo.PlayPojo;
import com.mecol.film.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.Map;
@Controller
@RequestMapping("/root")
public class AdminController {
@Autowired
private FilmCategoryService filmCategoryService;
@Autowired
private FilmService filmService;
@Autowired
private AdminService adminService;
@Autowired
private PlayService playService;
@Autowired
private RoomService roomService;
@Autowired
private TicketService ticketService;
//输入/root/admin 打开后台登陆首页
@RequestMapping("/admin")
public String admin(Model model, HttpServletRequest request){
HttpSession session=request.getSession();
Admin admin= (Admin) session.getAttribute("admin");
model.addAttribute("admin",admin);
return "admin/admin/admin";
}
@RequestMapping("/tuichu")
@ResponseBody
public String tui(HttpServletRequest request){
HttpSession session=request.getSession();
session.removeAttribute("admin");
return "admin/login";
}
@RequestMapping("/home")
public String home(){
return "admin/admin/home";
}
@RequestMapping("/type")
public String type(Integer page, Model model){
model.addAttribute("type",filmCategoryService.list(page,null));
return "admin/admin/type";
}
@RequestMapping(value = "/typedelete",method = RequestMethod.POST)
@ResponseBody
public Integer typedelete(FilmCategory filmCategory){
filmCategory.setIsDelete(0);
return filmCategoryService.update(filmCategory);
}
@RequestMapping("/isfilm")
public String isfilm(Integer page,Model model){
model.addAttribute("map",filmService.list(page,5));
model.addAttribute("type",filmCategoryService.all());
model.addAttribute("is",1);
return "admin/admin/isfilm";
}
/**
* 添加类型
* @param filmCategory
* @return
*/
@RequestMapping("/add")
@ResponseBody
public Integer add(FilmCategory filmCategory){
return filmCategoryService.add(filmCategory);
}
@RequestMapping("/typeupdate")
@ResponseBody
public Integer typeupdate(FilmCategory filmCategory){
return filmCategoryService.update(filmCategory);
}
@RequestMapping("/addfilm")
@ResponseBody
public Integer addfilm(FilmPojo filmPojo, HttpServletRequest request){
System.out.println(filmPojo);
return filmService.add(filmPojo,request);
}
@RequestMapping("/xiajia")
@ResponseBody
public Integer xiajia(DeleteAndUp deleteAndUp){
if (deleteAndUp.getMode().equals("下架")){
return filmService.delete(deleteAndUp.getId());
}else if (deleteAndUp.getMode().equals("上架")){
return filmService.up(deleteAndUp.getId());
}
return 0;
}
@RequestMapping("/isdelete")
public String isdelete(Integer page,Model model){
model.addAttribute("map",filmService.isDelete(page,5));
model.addAttribute("type",filmCategoryService.all());
model.addAttribute("is",0);
return "admin/admin/isfilm";
}
@RequestMapping("/room")
public String room(Integer page,Model model){
if (page==null){
page=1;
}
model.addAttribute("is",1);
model.addAttribute("film",filmService.listF());
model.addAttribute("room",roomService.list());
Map map=playService.list(page);
model.addAttribute("map",map);
return "admin/admin/room";
}
@RequestMapping("/deroom")
public String deroom(Integer page,Model model){
if (page==null){
page=1;
}
model.addAttribute("is",0);
model.addAttribute("film",filmService.listF());
model.addAttribute("room",roomService.list());
Map map=playService.delist(page);
model.addAttribute("map",map);
return "admin/admin/room";
}
@RequestMapping("/ticket")
public String ticket(Integer page,Model model){
if (page==null){
page=1;
}
Map<String,Object> map=ticketService.getAllUserList(page);
model.addAttribute("map",map);
return "admin/admin/allTickets";
}
@RequestMapping("/ticketDel")
@ResponseBody
public Integer ticketDel(Ticket ticket){
// System.out.println(ticket.getTicketId());
return ticketService.deleteById(ticket.getTicketId());
}
@RequestMapping("/play")
@ResponseBody
public Integer play(DeleteAndUp deleteAndUp){
Play play=new Play();
if (deleteAndUp.getMode().equals("下档")){
play.setPlayId(deleteAndUp.getId());
play.setIsDelete(0);
}else if (deleteAndUp.getMode().equals("上映")){
play.setPlayId(deleteAndUp.getId());
play.setIsDelete(1);
}
return playService.update(play);
}
@RequestMapping("/playAdd")
@ResponseBody
public Integer playAdd(PlayPojo play){
System.out.println(play);
return playService.add(play);
}
}
package com.mecol.film.service;
import com.mecol.film.entity.Admin;
import java.io.UnsupportedEncodingException;
public interface AdminService {
/**
* 管理员登录
* @param admin
* @return
*/
Admin login(Admin admin) throws UnsupportedEncodingException;
}
package com.mecol.film.mapper;
import com.mecol.film.entity.Admin;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface AdminMapper {
/**
* 管理员登录
* @param admin
* @return
*/
Admin login(Admin admin);
List<Admin> list();
/**
* 修改
* @param admin
* @return
*/
int update(Admin admin);
}