项目背景
随着互联网和电子商务的快速发展,开发一个电影院订票系统来帮助电影院对电影信息,售票信息进行统一化的信息管理;
遇到的问题
在设计的过程中,需要解决以下的几个问题:
- 电影院会有多个播放厅,从而在同一时间播放不同的电影来满足客户需求
- 每个厅的大小可能不同,即容纳的人数不同
- 电影院会不断引进新片
- 电影院会把电影安排在各个播放厅的不同时间段来进行播放,即会有一个排片表
- 一个客户可能买一张或多张电影票,这些电影票可能会是不同厅,不同场次的电影
项目简短介绍
电影院系统包含下面的一些模块:
登录
电影类别管理
电影信息管理
放映大厅管理
员工信息管理
放映信息管理
售票信息管理,用户在线选座
收益管理
收入明细
项目环境
> 前端:html, css, js, layui, jquery等;
> 后端:java, spring,maven等
> 开发工具:支持eclipse或idea
> 数据库:mysql
> 更多内容查看:http://projecthelp.top
部分核心代码
import org.springframework.stereotype.Service;
import xyz.shiguangliang.mybatis.dao.UserMapper;
import xyz.shiguangliang.mybatis.domain.User;
import xyz.shiguangliang.service.UserService;
import xyz.shiguangliang.util.query.QueryInfo;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@Service
public class UserServiceImpl implements UserService {
@Resource
private UserMapper userMapper;
//登录
@Override
public User login(String username, String password) {
User user = userMapper.selectLogin(username,password);
if (user != null) {
//登录次数加一
if (user.getIntimes() != null) {
user.setIntimes(user.getIntimes() + 1);
}else {
user.setIntimes(1);
}
//更新登录时间
user.setLastlogin(new Date());
return user;
}
return null;
}
//注册
@Override
public boolean register(User user) {
int i = 0;
//检测用户是否存在
User user1 = userMapper.selectUsername(user.getUsername());
if (user1 == null) {
i = userMapper.insert(user);
}
return i > 0;
}
//用户列表
@Override
public QueryInfo getUserList(String query, Integer pagenum,Integer pagesize) {
QueryInfo queryInfo = new QueryInfo();
int start;
int end;
if (pagenum == null||pagesize == null){
pagenum =0;
pagesize = 3;
}
start = (pagenum-1)*pagesize;
end = pagesize;
int userSize = userMapper.selectUserListLimitSize(query,start,end);
List<User> users = userMapper.selectUserListLimit(query,start,end);
queryInfo.setList(users);
queryInfo.setTotal(userSize);
return queryInfo;
}
//删除用户
@Override
public int deleteUser(Integer tid) {
return userMapper.deleteByPrimaryKey(tid);
}
//通过id查找用户
@Override
public User findById(Integer tid) {
return userMapper.selectByPrimaryKey(tid);
}
//更新用户
@Override
public int updateUser(User user) {
if (user.getPassword()==null|| Objects.equals(user.getPassword(), "")){
user.setPassword(userMapper.selectByPrimaryKey(user.getTid()).getPassword());
}
return userMapper.updateByPrimaryKey(user);
}
//通过用户名查找用户
@Override
public User findByUsername(String username) {
return userMapper.selectUsername(username);
}
//获取用户权限
@Override
public int getPower(String username) {
return userMapper.selectUsername(username).getPower();
}
}
useMapper.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="xyz.shiguangliang.mybatis.dao.UserMapper">
<resultMap id="BaseResultMap" type="xyz.shiguangliang.mybatis.domain.User">
<id column="tid" jdbcType="INTEGER" property="tid" />
<result column="username" jdbcType="VARCHAR" property="username" />
<result column="password" jdbcType="VARCHAR" property="password" />
<result column="teachername" jdbcType="VARCHAR" property="teachername" />
<result column="dno" jdbcType="INTEGER" property="dno" />
<result column="power" jdbcType="INTEGER" property="power" />
<result column="intimes" jdbcType="INTEGER" property="intimes" />
<result column="lastlogin" jdbcType="TIMESTAMP" property="lastlogin" />
</resultMap>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from teacher
where tid = #{tid,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="xyz.shiguangliang.mybatis.domain.User">
insert into teacher (tid, username, password,
teachername, dno, power,
intimes, lastlogin)
values (#{tid,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{teachername,jdbcType=VARCHAR}, #{dno,jdbcType=INTEGER}, #{power,jdbcType=INTEGER},
#{intimes,jdbcType=INTEGER}, #{lastlogin,jdbcType=TIMESTAMP})
</insert>
<update id="updateByPrimaryKey" parameterType="xyz.shiguangliang.mybatis.domain.User">
update teacher
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
teachername = #{teachername,jdbcType=VARCHAR},
dno = #{dno,jdbcType=INTEGER},
power = #{power,jdbcType=INTEGER},
intimes = #{intimes,jdbcType=INTEGER},
lastlogin = #{lastlogin,jdbcType=TIMESTAMP}
where tid = #{tid,jdbcType=INTEGER}
</update>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select tid, username, password, teachername, dno, power, intimes, lastlogin
from teacher
where tid = #{tid,jdbcType=INTEGER}
</select>
<select id="selectAll" resultMap="BaseResultMap">
select tid, username, password, teachername, dno, power, intimes, lastlogin
from teacher
</select>
<select id="selectLogin" resultType="xyz.shiguangliang.mybatis.domain.User">
select tid, username, password, teachername, dno, power, intimes, lastlogin
from teacher
where username = #{username} and password = #{password}
</select>
<select id="selectUsername" resultType="xyz.shiguangliang.mybatis.domain.User">
select tid, username, password, teachername, dno, power, intimes, lastlogin
from teacher
where username = #{username}
</select>
<select id="selectUserListLimit" resultType="xyz.shiguangliang.mybatis.domain.User">
select tid, username, password, teachername, dno, power, intimes, lastlogin
from teacher
where
/*条件判断*/
<if test="#{query} != null and #{query} != ''">
/*模糊查询*/
<bind name="query2" value="'%' + query + '%'"/>
username like #{query2}
</if>
LIMIT #{start},#{end}
</select>
<select id="selectUserListLimitSize" resultType="java.lang.Integer">
select count(*)
from teacher
where
/*条件判断*/
<if test="#{query} != null and #{query} != ''">
/*模糊查询*/
<bind name="query2" value="'%' + query + '%'"/>
username like #{query2}
</if>
</select>
</mapper>
项目展示
- 登录
- 首页
- 电影类别管理
- 电影信息管理
- 放映大厅管理
- 员工信息管理
- 放映信息管理
- 售票信息管理
- 收益管理
- 总收入明细
- 系统完整