项目类型:SSM项目(B/S架构)
项目名称:基于SSM的电影院购票系统
用户类型:2个角色(管理员+购票者) 系统类型:前端订票界面+后台管理 设计模式:SSM
界面外观:Bootstrap+CSS+JS 开发工具:Idea 数据库:Mysql+Navicat 数据库表:13
🍅?作者介绍:计科学长,可以免费指导降低查重,定期发布高质量手工开发源码,提供课程设计和毕业设计的指导!双1流高校刚毕业的学长,曾经也是个小白!
🍅?(公众号——学长源码)
🍅?关注回复??? 练习? ?免费get? ? 教研评教系统(课程设计练手项目)
🍅?关注回复? ??学生? ?免费get? ?一套JavaWeb源码
🍅?关注回复? ? ppt? ? ?免费get? ?367套毕设答辩ppt模板
🍅?关注回复? ?简历? ? 免费get? ?200套程序猿简历模板
🍅?关注获取地址:其他项目以及项目来源(公众号——学长源码)
🍅 毕业设计大全链接
?🍅?免费ppt资源:??
🍅?免费简历资源:?? ? ??
目录
前端功能介绍
影院首页
用户注册
影片介绍
购票页面
用户个人中心
影城介绍
个人信息修改
后台管理功能介绍
后台首页
电影分类管理
添加和修改分类
电影信息管理(上架以后的电影可以下架,下架的可以恢复再次上映)
电影上架
上映管理(添加影片以后,需要上档才能够被用户进行购票)
添加新档期
数据库设计
项目结构
?部分代码演示(以用户购买电影票为例)
用户登录注册模块的mapper
订票模块的mapper
选座位模块的mapper
前端功能介绍
影院首页
用户注册
影片介绍
购票页面
可以选择指定日期得电影,通过Ajax刷新。其中黑色表示已经被其他用户购买了,只能选择绿色得座位进行购票。并且可以同时购买多张电影票。
用户个人中心
影城介绍
个人信息修改
后台管理功能介绍
后台首页
电影分类管理
添加和修改分类
电影信息管理(上架以后的电影可以下架,下架的可以恢复再次上映)
电影上架
上映管理(添加影片以后,需要上档才能够被用户进行购票)
添加新档期
数据库设计
项目结构
?部分代码演示(以用户购买电影票为例)
Controller端代码部分
/**
* 首页
* @param user
* @param request
* @param model
* @return
*/
@RequestMapping("/")
public String index(@ModelAttribute Users user, HttpServletRequest request,Model model){
HttpSession session=request.getSession();
user= (Users) session.getAttribute("user");
Map<String,Object> map =filmService.list(1,8);
model.addAttribute("map",map);
System.out.println(user);
if (user!=null){
model.addAttribute("user",user);
}else {
Users u = new Users();
u.setUserName("1");
model.addAttribute("userb", u);
}
return "user/home";
}
/**
* 电影详细
* @param filmId
* @param user
* @param request
* @param model
* @return
*/
@RequestMapping("/filma")
public String film(Integer filmId,Users user,HttpServletRequest request,Model model){
HttpSession session=request.getSession();
user= (Users) session.getAttribute("user");
model.addAttribute("user",user);
Film film=filmService.film(filmId);
model.addAttribute("film",film);
System.out.println(film);
return "user/film";
/* return "user/home";*/
}
/**
* 购票界面
* @param filmId
* @param user
* @param request
* @param model
* @return
*/
@RequestMapping("/goupiao")
public String goupiao(Integer filmId,Users user,HttpServletRequest request,Model model){
HttpSession session=request.getSession();
user= (Users) session.getAttribute("user");
model.addAttribute("user",user);
List<Play> list=playService.filmById(filmId);
model.addAttribute("list",list);
Play play=playService.playById(list.get(0).getPlayId());
System.out.println("a"+play);
model.addAttribute("play",play);
return "user/goupiao";
}
/**
* 跟换排期
* @param playId
* @param user
* @param request
* @param model
* @return
*/
@RequestMapping("/goupiao2")
public String goupiao2(Integer playId,Users user,HttpServletRequest request,Model model){
HttpSession session=request.getSession();
user= (Users) session.getAttribute("user");
model.addAttribute("user",user);
Play play=playService.playById(playId);
model.addAttribute("play",play);
List<Play> list=playService.filmById(play.getFilm().getFilmId());
model.addAttribute("list",list);
model.addAttribute("index",playId);
return "user/goupiao";
}
/**
*已被购买的
* @param playId
* @param user
* @return
*/
@RequestMapping("/mai")
@ResponseBody
public String mai(Integer playId, Users user){
System.out.println(playId);
List<Ticket> list=ticketService.playById(playId);
System.out.println(list);
/* model.addAttribute("ticket",list);*/
Map<String,Object> map=new HashMap<String,Object>();
map.put("ticket",list);
String a= JSON.toJSONString(map);
return a;
}
/**
* 影城介绍
* @param user
* @param request
* @param model
* @return
*/
@RequestMapping("/we")
public String we(@ModelAttribute Users user, HttpServletRequest request,Model model){
HttpSession session=request.getSession();
user= (Users) session.getAttribute("user");
System.out.println(user);
if (user!=null){
model.addAttribute("user",user);
}else {
Users u = new Users();
u.setUserName("1");
model.addAttribute("userb", u);
}
return "user/jies";
}
/**
* 登录
* @param users
* @param request
* @return
*/
@RequestMapping("/login")
@ResponseBody
public Users login(Users users, HttpServletRequest request){
Users user= null;
user = userService.login(users,request);
System.out.println(user);
if (user!=null){
HttpSession session=request.getSession();
session.setAttribute("user",user);
System.out.println(session.getAttribute("user"));
return user;
}else{
return null;
}
}
/**
* 用户退出
* @param request
* @return
*/
@RequestMapping("/tui")
@ResponseBody
public String tui(HttpServletRequest request){
HttpSession session=request.getSession();
session.removeAttribute("user");
return "";
}
/**
* 购买电影票
* @param tic
* @param request
* @return
*/
@RequestMapping(value = "/goumai",method = RequestMethod.POST)
@ResponseBody
public Integer goumai(Tic tic,HttpServletRequest request){
HttpSession session=request.getSession();
Users user= (Users) session.getAttribute("user");
tic.setUserId(user.getUserId());
System.out.println(tic);
int a=ticketService.add(tic);
return a;
}
@RequestMapping("/list")
public ModelAndView List(){
ModelAndView modelAndView=new ModelAndView("user/listfilm");
Map<String,Object> map= filmService.list(1,8);
modelAndView.addObject("map",map);
return modelAndView;
}
@RequestMapping("/filmlist")
public ModelAndView filmList(Integer page){
ModelAndView modelAndView=new ModelAndView("user/listfilm");
Map<String,Object> map= filmService.list(page,8);
modelAndView.addObject("map",map);
return modelAndView;
}
@RequestMapping("/mohu")
public String mohu(String name,Integer page,Model model){
Map map=filmService.mohu(name,page);
model.addAttribute("map",map);
return "user/listfilm";
}
@RequestMapping("/zhu")
@ResponseBody
public Integer zhu(Users users){
return userService.add(users);
}
@RequestMapping("/personal")
public String personal(Integer page,HttpServletRequest request,Model model){
Users users=new Users();
HttpSession session=request.getSession();
users= (Users) session.getAttribute("user");
System.out.println(users);
if (page==null){
page=1;
}
if (users!=null){
/*修改完后时实更新*/
Map<String,Object> map=ticketService.userList(page,users.getUserId());
model.addAttribute("map",map);
/*model.addAttribute("user",users);*/
Users u=userService.upLogin(users,request);
session.setAttribute("user",u);
model.addAttribute("user",session.getAttribute("user"));
}else{
Map<String,Object> map=new HashMap<String, Object>();
map.put("pages",0);
map.put("pageNum",0);
model.addAttribute("map",map);
}
return "user/personal";
}
@RequestMapping(value = "/update",method = RequestMethod.POST)
public String update(UserPojo userPojo,HttpServletRequest request){
Users users=new Users();
HttpSession session=request.getSession();
users= (Users) session.getAttribute("user");
userPojo.setUserId(users.getUserId());
userService.update(userPojo,request);
return "redirect:/personal";
}
}
用户登录注册模块的mapper
<!--根据id找用户-->
<select id="userById" parameterType="Integer" resultType="com.wwt.entity.Users">
select * from users where user_id=#{id} and is_delete=1
</select>
<!--登录-->
<select id="login" parameterType="com.wwt.entity.Users" resultType="com.wwt.entity.Users">
select * from users
<where>
user_account=#{userAccount} and user_password=#{userPassword} and is_delete=1
</where>
</select>
<!--修改-->
<update id="update" parameterType="com.wwt.entity.Users">
update users
<set>
<if test="userName!=null and userName!=''">
user_name=#{userName},
</if>
<if test="userPassword!=null and userPassword!=''">
user_password=#{userPassword},
</if>
<if test="sex!=null">
sex=#{sex},
</if>
<if test="userEmli!=null and userEmli!=''">
user_emli=#{userEmli},
</if>
<if test="userPhone!=null and userPhone!=''">
user_phone=#{userPhone},
</if>
<if test="imgUrl!=null and imgUrl!=''">
img_url=#{imgUrl},
</if>
<if test="lastIp!=null and lastIp!=''">
last_ip=#{lastIp},
</if>
<if test="updateTime!=null and updateTime!=''">
update_time=#{updateTime},
</if>
</set>
where user_id=#{userId} and is_delete=1
</update>
<insert id="add" parameterType="com.wwt.entity.Users">
insert into users(user_name,user_account,user_password,user_emli,user_phone,create_time,update_time,img_url)
value
(#{userName},#{userAccount},#{userPassword},#{userEmli},#{userPhone},#{createTime},#{updateTime},'/img/ht.jpg')
</insert>
订票模块的mapper
<resultMap id="TicketMap" type="com.wwt.entity.Ticket">
<id property="ticketId" column="ticket_id"/>
<result property="buyingTime" column="buying_time"/>
<association property="play" column="play_id" javaType="com.wwt.entity.Play" select="com.wwt.mapper.PlayMapper.playById"/>
<association property="seat" column="seat_id" javaType="com.wwt.entity.Seat" select="com.wwt.mapper.SeatMapper.seatById"/>
</resultMap>
<select id="playById" parameterType="Integer" resultMap="TicketMap">
select t.*,p.play_id play_id ,s.seat_id seat_id from play p,ticket t,seat s where p.play_id=t.play_id and s.seat_id=t.seat_id and t.play_id=#{id}
</select>
<select id="userList" parameterType="Integer" resultMap="TicketMap">
select t.*,p.play_id play_id ,s.seat_id seat_id from play p,ticket t,seat s where p.play_id=t.play_id and s.seat_id=t.seat_id and t.user_id=#{id} ORDER BY t.ticket_id DESC
</select>
<insert id="add" parameterType="com.wwt.pojo.TicA">
insert into ticket value (null,#{playId},#{userId},#{seatId},#{buyingTime})
</insert>
选座位模块的mapper
<select id="seatById" parameterType="Integer" resultType="com.wwt.entity.Seat">
select * from seat where seat_id=#{id}
</select>
<select id="seatBySeat" parameterType="String" resultType="com.wwt.entity.Seat">
select * from seat where seat=#{seat}
</select>
|