当前位置: 首页 > news >正文

Java项目:112SSM在线电影订票系统

博主主页:Java旅途
简介:分享计算机知识、学习路线、系统源码及教程
文末获取源码

一、项目介绍

在线电影订票系统基于Spring+SpringMVC+Mybatis开发,系统分为前台和后台,前台主要用来用户浏览电影信息,订票,评价等操作,后台主要是用来管理电影,用户等。

前台功能如下:

  • 网站公告
  • 推荐电影
  • 全部电影
  • 电影订票
  • 电影评价
  • 我的订单
  • 购物车
  • 个人中心,

后台功能如下:

  • 管理员信息
  • 网站用户信息
  • 新闻公告信息
  • 电影类型信息
  • 城市信息
  • 影院信息
  • 电影信息
  • 订单信息
  • 电影评价信息等功能

二、技术框架

  • 后端:Spring,Springmvc,Mybatis
  • 前端:jquery,bootstrap

三、安装教程

  1. 用idea打开项目
  2. 在idea中配置jdk环境
  3. 配置tomcat8.0
  4. 新建数据库,导入数据库文件
  5. 在springmvc-servlet.xml文件中将数据库账号密码改成自己本地的
  6. 启动运行, 后台管理员账号密码 admin/123456,前台用户账号密码 xiaoli/123456

四、运行截图

image-20230712103609782

sy

tj

image-20230712103847027

image-20230712103936538

image-20230712103954221

image-20230712104013433

五、相关代码

FilmAction

package com.action;import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import com.entity.Film;
import com.service.FilmService;
import com.entity.Cate;
import com.service.CateService;
import com.util.PageHelper;//定义为控制器
@Controller
// 设置路径
@RequestMapping(value = "/film", produces = "text/plain;charset=utf-8")
public class FilmAction extends BaseAction {// 注入Service 由于标签的存在 所以不需要getter setter@Autowired@Resourceprivate FilmService filmService;@Autowired@Resourceprivate CateService cateService;// 准备添加数据@RequestMapping("createFilm.action")public String createFilm() {List<Cate> cateList = this.cateService.getAllCate();this.getRequest().setAttribute("cateList", cateList);return "admin/addfilm";}// 添加数据//-------------------------请加作者QQ协助运行: 549710689-----------------------------//-------------------------请加作者QQ协助运行: 549710689-----------------------------@RequestMapping("addFilm.action")public String addFilm(Film film) {film.setHits("0");film.setSellnum("0");this.filmService.insertFilm(film);return "redirect:/film/createFilm.action";}// 通过主键删除数据@RequestMapping("deleteFilm.action")public String deleteFilm(String id) {this.filmService.deleteFilm(id);return "redirect:/film/getAllFilm.action";}// 批量删除数据@RequestMapping("deleteFilmByIds.action")public String deleteFilmByIds() {String[] ids = this.getRequest().getParameterValues("filmid");for (String filmid : ids) {this.filmService.deleteFilm(filmid);}return "redirect:/film/getAllFilm.action";}// 更新数据@RequestMapping("updateFilm.action")public String updateFilm(Film film) {this.filmService.updateFilm(film);return "redirect:/film/getAllFilm.action";}// 显示全部数据@RequestMapping("getAllFilm.action")public String getAllFilm(String number) {List<Film> filmList = this.filmService.getAllFilm();PageHelper.getPage(filmList, "film", null, null, 10, number, this.getRequest(), null);return "admin/listfilm";}// 按条件查询数据 (模糊查询)@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";}// 按主键查询数据@RequestMapping("getFilmById.action")public String getFilmById(String id) {Film film = this.filmService.getFilmById(id);this.getRequest().setAttribute("film", film);List<Cate> cateList = this.cateService.getAllCate();this.getRequest().setAttribute("cateList", cateList);return "admin/editfilm";}public FilmService getFilmService() {return filmService;}public void setFilmService(FilmService filmService) {this.filmService = filmService;}}

IndexAction

package com.action;import java.util.ArrayList;
import java.util.List;import javax.annotation.Resource;import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;import com.entity.Article;
import com.entity.Cart;
import com.entity.Cate;
import com.entity.City;
import com.entity.Details;
import com.entity.Film;
import com.entity.Orders;
import com.entity.Topic;
import com.entity.Users;
import com.service.ArticleService;
import com.service.CartService;
import com.service.CateService;
import com.service.CinemaService;
import com.service.CityService;
import com.service.DetailsService;
import com.service.FilmService;
import com.service.OrdersService;
import com.service.TopicService;
import com.service.UsersService;
import com.util.VeDate;//定义为控制器
@Controller
// 设置路径
@RequestMapping("/index")
public class IndexAction extends BaseAction {@Autowired@Resourceprivate UsersService usersService;@Autowired@Resourceprivate ArticleService articleService;@Autowired@Resourceprivate CateService cateService;@Autowired@Resourceprivate CityService cityService;@Autowired@Resourceprivate CinemaService cinemaService;@Autowired@Resourceprivate FilmService filmService;@Autowired@Resourceprivate CartService cartService;@Autowired@Resourceprivate OrdersService ordersService;@Autowired@Resourceprivate DetailsService detailsService;@Autowired@Resourceprivate TopicService topicService;// 公共方法 提供公共查询数据private void front() {this.getRequest().setAttribute("title", "在线电影订票系统");List<Cate> cateList = this.cateService.getAllCate();this.getRequest().setAttribute("cateList", cateList);List<Film> hotList = this.filmService.getFilmByHot();this.getRequest().setAttribute("hotList", hotList);}// 首页显示@RequestMapping("index.action")public String index() {this.front();List<Cate> cateList = this.cateService.getCateFront();List<Cate> frontList = new ArrayList<Cate>();for (Cate cate : cateList) {List<Film> flimList = this.filmService.getFilmByCate(cate.getCateid());cate.setFlimList(flimList);frontList.add(cate);}this.getRequest().setAttribute("frontList", frontList);return "users/index";}// 公告@RequestMapping("article.action")public String article(String number) {this.front();List<Article> articleList = new ArrayList<Article>();List<Article> tempList = this.articleService.getAllArticle();int pageNumber = tempList.size();int maxPage = pageNumber;if (maxPage % 12 == 0) {maxPage = maxPage / 12;} else {maxPage = maxPage / 12 + 1;}if (number == null) {number = "0";}int start = Integer.parseInt(number) * 12;int over = (Integer.parseInt(number) + 1) * 12;int count = pageNumber - over;if (count <= 0) {over = pageNumber;}for (int i = start; i < over; i++) {Article x = tempList.get(i);articleList.add(x);}String html = "";StringBuffer buffer = new StringBuffer();buffer.append("&nbsp;&nbsp;共为");buffer.append(maxPage);buffer.append("页&nbsp; 共有");buffer.append(pageNumber);buffer.append("条&nbsp; 当前为第");buffer.append((Integer.parseInt(number) + 1));buffer.append("页 &nbsp;");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("首页");} else {buffer.append("<a href=\"index/article.action?number=0\">首页</a>");}buffer.append("&nbsp;&nbsp;");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("上一页");} else {buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");}buffer.append("&nbsp;&nbsp;");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("下一页");} else {buffer.append("<a href=\"index/article.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");}buffer.append("&nbsp;&nbsp;");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("尾页");} else {buffer.append("<a href=\"index/article.action?number=" + (maxPage - 1) + "\">尾页</a>");}html = buffer.toString();this.getRequest().setAttribute("html", html);this.getRequest().setAttribute("articleList", articleList);return "users/article";}// 阅读公告@RequestMapping("read.action")public String read(String id) {this.front();Article article = this.articleService.getArticleById(id);article.setHits("" + (Integer.parseInt(article.getHits()) + 1));this.articleService.updateArticle(article);this.getRequest().setAttribute("article", article);return "users/read";}// 准备登录@RequestMapping("preLogin.action")public String prelogin() {this.front();return "users/login";}// 用户登录@RequestMapping("login.action")public String login() {this.front();String username = this.getRequest().getParameter("username");String password = this.getRequest().getParameter("password");Users u = new Users();u.setUsername(username);List<Users> usersList = this.usersService.getUsersByCond(u);if (usersList.size() == 0) {this.getSession().setAttribute("message", "用户名不存在");return "redirect:/index/preLogin.action";} else {Users users = usersList.get(0);if (password.equals(users.getPassword())) {this.getSession().setAttribute("userid", users.getUsersid());this.getSession().setAttribute("username", users.getUsername());this.getSession().setAttribute("users", users);return "redirect:/index/index.action";} else {this.getSession().setAttribute("message", "密码错误");return "redirect:/index/preLogin.action";}}}// 准备注册@RequestMapping("preReg.action")public String preReg() {this.front();return "users/register";}// 用户注册@RequestMapping("register.action")public String register(Users users) {this.front();Users u = new Users();u.setUsername(users.getUsername());List<Users> usersList = this.usersService.getUsersByCond(u);if (usersList.size() == 0) {users.setRegdate(VeDate.getStringDateShort());this.usersService.insertUsers(users);} else {this.getSession().setAttribute("message", "用户名已存在");return "redirect:/index/preReg.action";}return "redirect:/index/preLogin.action";}// 退出登录@RequestMapping("exit.action")public String exit() {this.front();this.getSession().removeAttribute("userid");this.getSession().removeAttribute("username");this.getSession().removeAttribute("users");return "index";}// 准备修改密码@RequestMapping("prePwd.action")public String prePwd() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}return "users/editpwd";}// 修改密码@RequestMapping("editpwd.action")public String editpwd() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");String password = this.getRequest().getParameter("password");String repassword = this.getRequest().getParameter("repassword");Users users = this.usersService.getUsersById(userid);if (password.equals(users.getPassword())) {users.setPassword(repassword);this.usersService.updateUsers(users);} else {this.getSession().setAttribute("message", "旧密码错误");return "redirect:/index/prePwd.action";}return "redirect:/index/prePwd.action";}@RequestMapping("usercenter.action")public String usercenter() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}return "users/usercenter";}@RequestMapping("userinfo.action")public String userinfo() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");this.getSession().setAttribute("users", this.usersService.getUsersById(userid));return "users/userinfo";}@RequestMapping("personal.action")public String personal(Users users) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}this.usersService.updateUsers(users);return "redirect:/index/userinfo.action";}// 添加产品到购物车@RequestMapping("addcart.action")public String addcart() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");Cart cart = new Cart();cart.setFilmid(getRequest().getParameter("goodsid"));cart.setNum(getRequest().getParameter("num"));cart.setPrice(getRequest().getParameter("price"));cart.setUsersid(userid);this.cartService.insertCart(cart);return "redirect:/index/cart.action";}// 查看购物车@RequestMapping("cart.action")public String cart() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");Cart cart = new Cart();cart.setUsersid(userid);List<Cart> cartList = this.cartService.getCartByCond(cart);this.getRequest().setAttribute("cartList", cartList);return "users/cart";}// 删除购物车中的产品@RequestMapping("deletecart.action")public String deletecart(String id) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}this.cartService.deleteCart(id);return "redirect:/index/cart.action";}// 准备结算@RequestMapping("preCheckout.action")public String preCheckout() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");Cart cart = new Cart();cart.setUsersid(userid);List<Cart> cartList = this.cartService.getCartByCond(cart);if (cartList.size() == 0) {this.getSession().setAttribute("message", "请选购商品");return "redirect:/index/cart.action";}List<City> cityList = this.cityService.getAllCity();this.getRequest().setAttribute("cityList", cityList);return "users/checkout";}// 结算@RequestMapping("checkout.action")public String checkout() {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");Cart cart1 = new Cart();cart1.setUsersid(userid);List<Cart> cartList = this.cartService.getCartByCond(cart1);if (cartList.size() == 0) {this.getRequest().setAttribute("message", "请选购商品");return "redirect:/index/cart.action";} else {// 获取一个1200-9999的随机数 防止同时提交String ordercode = "PD" + VeDate.getStringDatex();double total = 0;for (Cart cart : cartList) {Details details = new Details();details.setDetailsid(VeDate.getStringDatex() + (Math.random() * 9 + 1) * 1200);details.setFilmid(cart.getFilmid());details.setNum(cart.getNum());details.setOrdercode(ordercode);details.setPrice(cart.getPrice());details.setCinemaid(this.getRequest().getParameter("cinemaid"));details.setCityid(this.getRequest().getParameter("cityid"));details.setViewdate(this.getRequest().getParameter("viewdate"));this.detailsService.insertDetails(details);Film goods = this.filmService.getFilmById(cart.getFilmid());goods.setSellnum("" + (Integer.parseInt(goods.getSellnum()) + Integer.parseInt(cart.getNum())));this.filmService.updateFilm(goods);total += Double.parseDouble(cart.getPrice()) * Double.parseDouble(cart.getNum());this.cartService.deleteCart(cart.getCartid());}Orders orders = new Orders();orders.setAddtime(VeDate.getStringDateShort());orders.setOrdercode(ordercode);orders.setStatus("未付款");orders.setTotal("" + total);orders.setUsersid(userid);this.ordersService.insertOrders(orders);}return "redirect:/index/showOrders.action";}// 查看订购@RequestMapping("showOrders.action")public String showOrders(String number) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");Orders orders = new Orders();orders.setUsersid(userid);List<Orders> ordersList = new ArrayList<Orders>();List<Orders> tempList = this.ordersService.getOrdersByCond(orders);int pageNumber = tempList.size();int maxPage = pageNumber;if (maxPage % 12 == 0) {maxPage = maxPage / 12;} else {maxPage = maxPage / 12 + 1;}if (number == null) {number = "0";}int start = Integer.parseInt(number) * 12;int over = (Integer.parseInt(number) + 1) * 12;int count = pageNumber - over;if (count <= 0) {over = pageNumber;}for (int i = start; i < over; i++) {Orders o = tempList.get(i);ordersList.add(o);}String html = "";StringBuffer buffer = new StringBuffer();buffer.append("&nbsp;&nbsp;共为");buffer.append(maxPage);buffer.append("页&nbsp; 共有");buffer.append(pageNumber);buffer.append("条&nbsp; 当前为第");buffer.append((Integer.parseInt(number) + 1));buffer.append("页 &nbsp;");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("首页");} else {buffer.append("<a href=\"index/showOrders.action?number=0\">首页</a>");}buffer.append("&nbsp;&nbsp;");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("上一页");} else {buffer.append("<a href=\"index/showOrders.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");}buffer.append("&nbsp;&nbsp;");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("下一页");} else {buffer.append("<a href=\"index/showOrders.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");}buffer.append("&nbsp;&nbsp;");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("尾页");} else {buffer.append("<a href=\"index/showOrders.action?number=" + (maxPage - 1) + "\">尾页</a>");}html = buffer.toString();this.getRequest().setAttribute("html", html);this.getRequest().setAttribute("ordersList", ordersList);return "users/orderlist";}// 准备付款@RequestMapping("prePay.action")public String prePay(String id) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}this.getRequest().setAttribute("id", id);return "users/pay";}// 付款@RequestMapping("pay.action")public String pay(String id) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));orders.setStatus("已付款");this.ordersService.updateOrders(orders);return "redirect:/index/showOrders.action";}// 确认收货@RequestMapping("over.action")public String over(String id) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));orders.setStatus("已收货");this.ordersService.updateOrders(orders);return "redirect:/index/showOrders.action";}// 取消订单@RequestMapping("cancel.action")public String cancel(String id) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}Orders orders = this.ordersService.getOrdersById(this.getRequest().getParameter("id"));orders.setStatus("已取消");this.ordersService.updateOrders(orders);return "redirect:/index/showOrders.action";}// 订单明细@RequestMapping("orderdetail.action")public String orderdetail(String id) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}Details details = new Details();details.setOrdercode(id);List<Details> detailsList = this.detailsService.getDetailsByCond(details);this.getRequest().setAttribute("detailsList", detailsList);return "users/orderdetail";}// 按分类查询@RequestMapping("cate.action")public String cate(String id, String number) {this.front();Film goods = new Film();goods.setCateid(id);List<Film> flimList = new ArrayList<Film>();List<Film> tempList = this.filmService.getFilmByCond(goods);int pageNumber = tempList.size();int maxPage = pageNumber;if (maxPage % 12 == 0) {maxPage = maxPage / 12;} else {maxPage = maxPage / 12 + 1;}if (number == null) {number = "0";}int start = Integer.parseInt(number) * 12;int over = (Integer.parseInt(number) + 1) * 12;int count = pageNumber - over;if (count <= 0) {over = pageNumber;}for (int i = start; i < over; i++) {Film x = tempList.get(i);flimList.add(x);}String html = "";StringBuffer buffer = new StringBuffer();buffer.append("&nbsp;&nbsp;共为");buffer.append(maxPage);buffer.append("页&nbsp; 共有");buffer.append(pageNumber);buffer.append("条&nbsp; 当前为第");buffer.append((Integer.parseInt(number) + 1));buffer.append("页 &nbsp;");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("首页");} else {buffer.append("<a href=\"index/cate.action?number=0&id=\" + id+ \"\">首页</a>");}buffer.append("&nbsp;&nbsp;");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("上一页");} else {buffer.append("<a href=\"index/cate.action?number=" + (Integer.parseInt(number) - 1) + "&id=\" + id+ \"\">上一页</a>");}buffer.append("&nbsp;&nbsp;");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("下一页");} else {buffer.append("<a href=\"index/cate.action?number=" + (Integer.parseInt(number) + 1) + "&id=\" + id+ \"\">下一页</a>");}buffer.append("&nbsp;&nbsp;");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("尾页");} else {buffer.append("<a href=\"index/cate.action?number=" + (maxPage - 1) + "&id=\" + id+ \"\">尾页</a>");}html = buffer.toString();this.getRequest().setAttribute("html", html);this.getRequest().setAttribute("flimList", flimList);return "users/list";}// 推荐产品@RequestMapping("recommend.action")public String recommend(String number) {this.front();Film goods = new Film();goods.setRecommend("是");List<Film> flimList = new ArrayList<Film>();List<Film> tempList = this.filmService.getFilmByCond(goods);int pageNumber = tempList.size();int maxPage = pageNumber;if (maxPage % 12 == 0) {maxPage = maxPage / 12;} else {maxPage = maxPage / 12 + 1;}if (number == null) {number = "0";}int start = Integer.parseInt(number) * 12;int over = (Integer.parseInt(number) + 1) * 12;int count = pageNumber - over;if (count <= 0) {over = pageNumber;}for (int i = start; i < over; i++) {Film x = tempList.get(i);flimList.add(x);}String html = "";StringBuffer buffer = new StringBuffer();buffer.append("&nbsp;&nbsp;共为");buffer.append(maxPage);buffer.append("页&nbsp; 共有");buffer.append(pageNumber);buffer.append("条&nbsp; 当前为第");buffer.append((Integer.parseInt(number) + 1));buffer.append("页 &nbsp;");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("首页");} else {buffer.append("<a href=\"index/recommend.action?number=0\">首页</a>");}buffer.append("&nbsp;&nbsp;");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("上一页");} else {buffer.append("<a href=\"index/recommend.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");}buffer.append("&nbsp;&nbsp;");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("下一页");} else {buffer.append("<a href=\"index/recommend.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");}buffer.append("&nbsp;&nbsp;");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("尾页");} else {buffer.append("<a href=\"index/recommend.action?number=" + (maxPage - 1) + "\">尾页</a>");}html = buffer.toString();this.getRequest().setAttribute("html", html);this.getRequest().setAttribute("flimList", flimList);return "users/list";}// 全部产品@RequestMapping("all.action")public String all(String number) {this.front();List<Film> flimList = new ArrayList<Film>();List<Film> tempList = this.filmService.getAllFilm();int pageNumber = tempList.size();int maxPage = pageNumber;if (maxPage % 12 == 0) {maxPage = maxPage / 12;} else {maxPage = maxPage / 12 + 1;}if (number == null) {number = "0";}int start = Integer.parseInt(number) * 12;int over = (Integer.parseInt(number) + 1) * 12;int count = pageNumber - over;if (count <= 0) {over = pageNumber;}for (int i = start; i < over; i++) {Film x = tempList.get(i);flimList.add(x);}String html = "";StringBuffer buffer = new StringBuffer();buffer.append("&nbsp;&nbsp;共为");buffer.append(maxPage);buffer.append("页&nbsp; 共有");buffer.append(pageNumber);buffer.append("条&nbsp; 当前为第");buffer.append((Integer.parseInt(number) + 1));buffer.append("页 &nbsp;");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("首页");} else {buffer.append("<a href=\"index/all.action?number=0\">首页</a>");}buffer.append("&nbsp;&nbsp;");if ((Integer.parseInt(number) + 1) == 1) {buffer.append("上一页");} else {buffer.append("<a href=\"index/all.action?number=" + (Integer.parseInt(number) - 1) + "\">上一页</a>");}buffer.append("&nbsp;&nbsp;");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("下一页");} else {buffer.append("<a href=\"index/all.action?number=" + (Integer.parseInt(number) + 1) + "\">下一页</a>");}buffer.append("&nbsp;&nbsp;");if (maxPage <= (Integer.parseInt(number) + 1)) {buffer.append("尾页");} else {buffer.append("<a href=\"index/all.action?number=" + (maxPage - 1) + "\">尾页</a>");}html = buffer.toString();this.getRequest().setAttribute("html", html);this.getRequest().setAttribute("flimList", flimList);return "users/list";}// 查询商品@RequestMapping("query.action")public String query(String name) {this.front();Film goods = new Film();goods.setFilmname(name);List<Film> flimList = this.filmService.getFilmByLike(goods);this.getRequest().setAttribute("flimList", flimList);return "users/list";}// 商品详情@RequestMapping("detail.action")public String detail(String id) {this.front();Film goods = this.filmService.getFilmById(id);goods.setHits("" + (Integer.parseInt(goods.getHits()) + 1));this.filmService.updateFilm(goods);this.getRequest().setAttribute("goods", goods);Topic topic = new Topic();topic.setFilmid(id);List<Topic> topicList = this.topicService.getTopicByCond(topic);this.getRequest().setAttribute("topicList", topicList);this.getRequest().setAttribute("tnum", topicList.size());return "users/detail";}@RequestMapping("addTopic.action")public String addTopic(Topic topic) {this.front();if (this.getSession().getAttribute("userid") == null) {return "redirect:/index/preLogin.action";}String userid = (String) this.getSession().getAttribute("userid");topic.setAddtime(VeDate.getStringDateShort());topic.setContents(this.getRequest().getParameter("contents"));topic.setFilmid(this.getRequest().getParameter("goodsid"));topic.setNum(this.getRequest().getParameter("num"));topic.setUsersid(userid);this.topicService.insertTopic(topic);return "redirect:/index/detail.action?id=" + topic.getFilmid();}}

大家点赞、收藏、关注、评论啦 、👇🏻点开下方卡片👇🏻关注后回复 103

相关文章:

Java项目:112SSM在线电影订票系统

博主主页&#xff1a;Java旅途 简介&#xff1a;分享计算机知识、学习路线、系统源码及教程 文末获取源码 一、项目介绍 在线电影订票系统基于SpringSpringMVCMybatis开发&#xff0c;系统分为前台和后台&#xff0c;前台主要用来用户浏览电影信息&#xff0c;订票&#xff0c…...

Echarts——使用graphic组件在一个option内同时设置两个饼图的背景图

使用echarts的graphic原生图形元素组件&#xff0c;为两个饼图设置对应背景。 <template><div id"app"><div class"charts" ref"charts"></div></div> </template><script> import * as echarts from…...

编程笔记 html5cssjs 027 HTML输入属性(1/2)

[TOC](编程笔记 html5&css&js 027 HTML输入属性(1/2)) <input>元素除了type属性表示输入类型&#xff0c;后面还跟上其他属性&#xff0c;叫输入属性。 value 属性 value 属性规定输入字段的初始值&#xff1a; <form action"">First name:<…...

请求参数乱码问题

POST请求方式解决乱码问题 在web.xml里面设置编码过滤器 <filter><filter-name>CharacterEncodingFilter</filter-name><filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class><!-- 设置过滤器中的属性值 -…...

【leetcode】力扣热门之反转链表【简单难度】

题目描述 给你单链表的头节点 head &#xff0c;请你反转链表&#xff0c;并返回反转后的链表。 用例 输入&#xff1a;head [1,2,3,4,5] 输出&#xff1a;[5,4,3,2,1] 输入&#xff1a;head [1,2] 输出&#xff1a;[2,1] 输入&#xff1a;head [] 输出&#xff1a;[…...

【sgPasswordInput】自定义组件:带前端校验密码强度的密码输入框,能够提供密码强度颜色提示和文字提示

特性&#xff1a; 有密码强度颜色提示密码强度进度条提示支持设置默认输入提示和密码长度 sgPasswordInput源码 <template><div :class"$options.name" style"width: 100%"><el-inputstyle"width: 100%"ref"psw"type&…...

1599 - Ideal Path (UVA)

题目链接如下&#xff1a; https://onlinejudge.org/index.php?optioncom_onlinejudge&Itemid8&category448&pageshow_problem&problem4474 这道题也是看了刘汝佳的思路才写出来的.... 代码如下&#xff1a; #include <cstdio> #include <deque&…...

计算机网络(超级详细笔记)

使用教材计算机网络&#xff08;第8版&#xff09;&#xff08;谢希仁&#xff09; 第一章&#xff1a;概述 第二章&#xff1a;物理层 第三章&#xff1a;数据链路层 第四章&#xff1a;网络层 第五章&#xff1a;运输层 第六章&#xff1a;应用层 目…...

老杨说运维 | 年末大讲回顾:运维的尽头也是大模型吗?

哈喽~朋友们&#xff0c;这么快又见面啦。前阵子我们给CEO老杨安排了一场年末大讲&#xff0c;主要是跟大家聊聊智能运维的“智”与“能”以及剖析时下热点----运维大模型。后台收到了不少朋友的反馈&#xff0c;小编看了大受鼓舞并暗下决心----新的一年&#xff0c;希望能多安…...

Unity 利用UGUI之Scrollbar制作进度条

在Unity中除了用Slider、Image做进度条&#xff0c;其实用Scrollbar也可以做进度条。 首先&#xff0c;在场景中新建一个Scrollbar组件和一个Text组件&#xff1a; 其次&#xff0c;创建模拟进度的一个脚本&#xff0c;Scrollbar_Progressbar.cs: using System.Collections; …...

MySQL之导入、导出

文章目录 1.navicat导入导出2.mysqldump命令导入导出2.1导出2.2导入 3.load data infile命令导入导出4.远程备份5.思维导图 1.navicat导入导出 使用Navicat工具导入t_log 共耗时 55s 2.mysqldump命令导入导出 2.1导出 导出表数据和表结构 语法&#xff1a; mysqldump -u用…...

【unity小技巧】FPS游戏实现相机的偏移震动、武器射击后退和后坐力效果

最终效果 文章目录 最终效果前言相机偏移震动相机震动脚本换弹节点震动 武器射击后退效果武器后坐力效果完结 前言 关于后坐力之前其实已经分享了一个&#xff1a;FPS游戏后坐力制作思路 但是实现起来比较复杂&#xff0c;如果你只是想要简单的实现&#xff0c;可以看看这个&…...

MINCO+汽车

规划典型的解决方法: 如何准确的描述他的动力学,实际上是对这个物理对象进行建模.(规划等于开环的控制,控制等于闭环的规划),规划系统要做到是假设已知系统模型的情况下去计算一些可能会影响比较好的 未来运动的指令,做未来运动轨迹的推演.对自己建模的情况下还需对环境有个比较…...

大模型机器人发展史:从VoxPoser、RT2到斯坦福Mobile ALOHA、Google机器人

前言 23年7月&#xff0c;我在朋友圈评估Google的RT2说道&#xff1a; “大模型正在革新一切领域啊&#xff0c;超帅&#xff0c;通过大模型不仅能理解“人话”&#xff0c;还能对“人话”进行推理&#xff0c;并转变为机器人能理解的指令&#xff0c;从而分阶段完成任务。回…...

Ubunutu18.04 ROS melodic 无人机 XTDrone PX4 Vins-Fuison 运行配置

一、PX4飞控EKF配置 PX4默认使用的EKF配置为融合GPS的水平位置与气压计高度。如果我们想使用视觉定位&#xff0c;就需要把修改配置文件。让EKF融合来自mavros/vision_pose/pose的数据 1.1修改rcS配置文件 gedit ~/PX4_Firmware/ROMFS/px4fmu_common/init.d-posix/rcS 通过注…...

Linux 常见服务配置

笔记所以内容很多&#xff0c;建议选择性看看 SSH Secure Shell 用于与服务器建立安全的连接 对应服务 sshd 注意&#xff1a;配置文件 配制文件修改需要重启或重载sshd服务才能生效 systemctl sshd reload # 重载 sshd 配置文件 systemctl sshd restart # 重启 ssh…...

Flutter基础

一、关键字 class&#xff1a;用于定义一个新的类&#xff1b; extends: 用于指定一个类继承另一个类&#xff1b; mixin: 用于将一个类的代码片段添加到另一个类中&#xff0c;实现代码复用&#xff1b; abstract: 用于声明一个抽象类或抽象方法&#xff0c;不能直接实例化&a…...

MySQL-数据库概述

数据库相关概念&#xff1a; 数据库(DateBase)简称DB,就是一个存储数据的仓库&#xff0c;数据有组织的进行存储。 数据库分为关系型数据库简称RDBMS和非关系型数据库 关系型数据库简称RDBMS:建立在关系模型的基础上&#xff0c;由多张相互连接的二维表组成的数据库.简单来说…...

HTML---JQurey的基本使用

文章目录 前言一、pandas是什么&#xff1f;二、使用步骤 1.引入库2.读入数据总结 本章目标 &#xff08;1&#xff09;能够搭建jQuery开发环境 &#xff08;2&#xff09;使用ready( )方法加载页面、掌握jQuery语法 使用addClass( )方法和css( )方法为元素添加CSS样式使用n…...

搜索docker镜像

要查看Docker镜像库&#xff0c;可以使用docker search命令。 docker search <关键词>例如&#xff0c;如果你想要查找名为nginx的镜像&#xff0c;可以执行以下命令&#xff1a; docker search nginx命令执行后&#xff0c;将会列出所有与关键词nginx相关的Docker镜像…...

Proteus仿真STM32串口通信:从虚拟串口配置到数据收发实战

1. Proteus仿真STM32串口通信入门指南 第一次接触Proteus仿真STM32串口通信时&#xff0c;我被这个虚拟实验室的强大功能震撼到了。不需要昂贵的开发板&#xff0c;不用连接各种线缆&#xff0c;在电脑上就能完成嵌入式开发的完整流程。对于学生和初学者来说&#xff0c;这简直…...

FreeRTOS定时器VS硬件定时器:5个关键区别与选型建议(含STM32案例)

FreeRTOS定时器与硬件定时器深度对比&#xff1a;5大核心差异与STM32实战指南 1. 嵌入式系统中的定时器技术全景 在嵌入式系统设计中&#xff0c;定时器如同系统的心跳节拍器&#xff0c;承担着任务调度、事件触发、时序控制等关键职能。现代微控制器通常提供两种定时机制&…...

Qwen3-ASR-1.7B在音乐识别中的惊艳表现:RAP歌词转写准确率突破

Qwen3-ASR-1.7B在音乐识别中的惊艳表现&#xff1a;RAP歌词转写准确率突破 当语速飞快的RAP遇上AI语音识别&#xff0c;会发生什么&#xff1f;传统语音识别模型在快速说唱面前往往"听不清、跟不上"&#xff0c;但Qwen3-ASR-1.7B却给出了令人惊喜的答案。 1. 为什么R…...

制造知识断层:软件测试工程师的不可替代性构建策略

知识断层的战略意义在技术同质化日益严重的时代&#xff0c;软件测试从业者常陷入技能可复制的焦虑——自动化工具、测试框架、协议规范均可被标准化习得。真正的核心竞争力源于主动构建知识断层&#xff1a;通过非线性技能组合、垂直领域深耕及思维模式革新&#xff0c;使个人…...

从零开始学习Zookeeper:大数据分布式系统的守护者

从零开始学习Zookeeper:大数据分布式系统的守护者 关键词 Zookeeper、分布式协调、ZNode、ZAB协议、分布式锁、配置中心、服务注册与发现 摘要 在大数据与分布式系统的世界里,“协调"是最棘手的难题之一:如何让成百上千台机器像一个团队般默契协作?Zookeeper作为分…...

GME-Qwen2-VL-2B-Instruct多场景落地:从图文检索到AI内容合规审核

GME-Qwen2-VL-2B-Instruct多场景落地&#xff1a;从图文检索到AI内容合规审核 1. 工具核心价值与应用场景 GME-Qwen2-VL-2B-Instruct是一个强大的多模态视觉语言模型&#xff0c;但在实际使用中&#xff0c;很多开发者发现直接用官方方法进行图文匹配时&#xff0c;打分结果不…...

Whisper-large-v3快速上手:3步启动99语种AI语音识别Web服务

Whisper-large-v3快速上手&#xff1a;3步启动99语种AI语音识别Web服务 作者&#xff1a;by113小贝 | 10年AI工程实践经验 1. 开篇&#xff1a;为什么你需要这个语音识别服务&#xff1f; 如果你正在寻找一个能听懂99种语言的AI助手&#xff0c;不用再找了。Whisper-large-v3就…...

探索DeepSeek在双色球历史数据分析中的娱乐性应用

1. 先泼一盆冷水&#xff1a;AI预测彩票&#xff1f;这事儿不靠谱 我知道&#xff0c;点开这篇文章的你&#xff0c;心里可能揣着一个“一夜暴富”的小火苗。毕竟&#xff0c;谁没幻想过用高科技手段破解财富密码呢&#xff1f;我干了这么多年AI&#xff0c;也见过不少朋友拿着…...

黑龙江GEO,AI搜索优化黑龙江GEO,AI搜索优化品牌排行榜

在数字化浪潮下&#xff0c;黑龙江地区的企业和店铺面临着激烈的市场竞争&#xff0c;如何在AI搜索中脱颖而出成为了关键问题。知动网络技术服务有限公司&#xff0c;作为一家正规注册的老牌有限责任公司&#xff0c;在AI搜索优化与GEO服务领域深耕多年&#xff0c;为您提供专业…...

Spring Cloud Circuit Breaker 2.0.0 M1(Milestone 1)是 Spring Cloud 官方在 2022 年初发布的

Spring Cloud Circuit Breaker 2.0.0 M1(Milestone 1)是 Spring Cloud 官方在 2022 年初发布的 Spring Cloud Circuit Breaker 2.x 系列的首个里程碑版本,标志着该项目从旧版 spring-cloud-netflix-hystrix(已停更)和早期 spring-cloud-circuitbreaker(1.x)向统一、轻量…...