基于SSM的电影购票系统

系统采用SSM框架,前端使用css、js等,主要功能包括:查询特价电影或最新电影、以及分类查看、查看销售排行、公告、订票、下单、评论等,以及管理员管理相关功能

**

  • 首页如下

**
在这里插入图片描述
系统后端为SSM框架,主要配置如下:

<?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:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context 
http://www.springframework.org/schema/context/spring-context-4.3.xsd 
http://www.springframework.org/schema/mvc 
http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd 
http://www.springframework.org/schema/aop 
http://www.springframework.org/schema/aop/spring-aop-4.3.xsd 
http://www.springframework.org/schema/tx 
http://www.springframework.org/schema/tx/spring-tx-4.3.xsd">

	<!-- 启用自动扫描 -->
	<context:component-scan base-package="com"></context:component-scan>
	<!-- 启用springmvc相关Annotation的处理器 -->
	<mvc:annotation-driven />

	<!-- 采用注释的方式配置bean -->
	<context:annotation-config />
	<!--proxy-target-class="true"强制使用cglib代理 如果为false则spring会自动选择 -->
	<aop:aspectj-autoproxy proxy-target-class="true" />

	<!-- 配置dbcp数据源 -->
	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="org.gjt.mm.mysql.Driver" />
		<property name="url"
			value="jdbc:mysql://localhost:3306/movie?useUnicode=true&amp;characterEncoding=UTF-8" />
		<property name="username" value="root" />
		<property name="password" value="root" />
		<!-- 队列中的最小等待数 -->
		<property name="minIdle" value="1"></property>
		<!-- 队列中的最大等待数 -->
		<property name="maxIdle" value="5"></property>
		<!-- 最长等待时间,单位毫秒 -->
		<property name="maxWait" value="3000"></property>
		<!-- 最大活跃数 -->
		<property name="maxActive" value="5"></property>
		<property name="initialSize" value="3"></property>
	</bean>

	<!-- 配置mybitasSqlSessionFactoryBean -->
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="configLocation" value="classpath:mybatis.xml"></property>
		<!-- 扫描entity包 使用别名 -->
		<property name="typeAliasesPackage" value="com.entity" />
	</bean>

	<!-- 配置扫描DAO接口包,动态实现DAO接口,注入到spring容器中 -->
	<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
		<!-- 注入sqlSessionFactory -->
		<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
		<!-- 给出需要扫描DAO接口包 -->
		<property name="basePackage" value="com.dao" />
	</bean>

	<!-- 配置SqlSessionTemplate -->
	<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
		<constructor-arg name="sqlSessionFactory" ref="sqlSessionFactory" />
	</bean>

	<!-- 事务配置 -->
	<bean id="transactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>
	
	<!-- 允许静态资源请求,否则css、js、图片等资源无法加载显示 -->
    <mvc:annotation-driven/>
	
	<!-- 扫描包,这样的话该包下带有@Controller的注解将作为Bean注册进Spring容器  -->
    <context:component-scan base-package="com.controller"/>

	<!-- 定义跳转的文件的前后缀 ,视图模式配置 -->
	<bean
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<!-- 这里的配置是自动给后面action的方法return的字符串加上前缀和后缀,变成一个 可用的url地址 -->
		<property name="prefix" value="/" />
		<property name="suffix" value=".jsp" />
	</bean>

	<!-- 支持上传文件 -->
	<bean id="multipartResolver"
		class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="maxUploadSize" value="104857600" />
		<property name="maxInMemorySize" value="4096" />
		<property name="defaultEncoding" value="UTF-8"></property>
	</bean>

</beans>

后端采用controller层接受前端请求:

// 按条件查询数据 (模糊查询)
	@RequestMapping("queryFilmByCond.action")
	public String queryFilmByCond(String cond, String name, String number) {
    
    
		Film film = new Film();
		if (cond != null) {
    
    
			if ("filmname".equals(cond)) {
    
    
				film.setFilmname(name);
			}
			if ("image".equals(cond)) {
    
    
				film.setImage(name);
			}
			if ("cateid".equals(cond)) {
    
    
				film.setCateid(name);
			}
			if ("price".equals(cond)) {
    
    
				film.setPrice(name);
			}
			if ("recommend".equals(cond)) {
    
    
				film.setRecommend(name);
			}
			if ("thestart".equals(cond)) {
    
    
				film.setThestart(name);
			}
			if ("theend".equals(cond)) {
    
    
				film.setTheend(name);
			}
			if ("hits".equals(cond)) {
    
    
				film.setHits(name);
			}
			if ("sellnum".equals(cond)) {
    
    
				film.setSellnum(name);
			}
			if ("contents".equals(cond)) {
    
    
				film.setContents(name);
			}
		}

		List<String> nameList = new ArrayList<String>();
		List<String> valueList = new ArrayList<String>();
		nameList.add(cond);
		valueList.add(name);
		PageHelper.getPage(this.filmService.getFilmByLike(film), "film", nameList, valueList, 10, number, this.getRequest(), "query");
		name = null;
		cond = null;
		return "admin/queryfilm";
	}

**

  • 下面是特价电影:

**
在这里插入图片描述
**

  • 分类查看电影:

**

在这里插入图片描述
**

  • 电影详情:

**
在这里插入图片描述
**

  • 在电影详情中可以查看电影的情况,可以定不同档次的座位:

**
在这里插入图片描述
**

  • 后台的首页

**
在这里插入图片描述
**

  • 其他的后台功能

**
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
**

  • 下面就是项目的结构和数据库:

**
在这里插入图片描述
在这里插入图片描述
好了,上面就是系统的实现,如果大家有什么问题,可以私信交流学习。

猜你喜欢

转载自blog.csdn.net/mtyedu/article/details/113100440
今日推荐