当前位置: 首页 > 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镜像…...

2026-03-27:替换至多一个元素后最长非递减子数组。用go语言,给定一个整数数组 nums。 你最多只能选择其中一个位置的元素,把它改成任意整数(也可以选择不改)。 在允许这种“最多一次改动”的

2026-03-27&#xff1a;替换至多一个元素后最长非递减子数组。用go语言&#xff0c;给定一个整数数组 nums。 你最多只能选择其中一个位置的元素&#xff0c;把它改成任意整数&#xff08;也可以选择不改&#xff09;。 在允许这种“最多一次改动”的情况下&#xff0c;求能得到…...

全向轮底盘运动控制:嵌入式PID与逆运动学实现

1. 全向轮底盘控制库&#xff08;omni_wheel&#xff09;技术解析与工程实践1.1 项目背景与工程定位omni_wheel是为B团队自主移动机器人开发的底层运动控制模块&#xff0c;最初版本发布于2018年7月10日。从其原始README描述“PIDかけて一方向に進むだけのプログラムでござんす…...

从‘偏差-方差’到一行代码:用NumPy/PyTorch五步实现GAE,附PPO实战避坑点

从‘偏差-方差’到一行代码&#xff1a;用NumPy/PyTorch五步实现GAE&#xff0c;附PPO实战避坑点 强化学习中的策略优化常常面临一个核心挑战&#xff1a;如何准确评估动作的价值&#xff1f;广义优势估计&#xff08;GAE&#xff09;通过巧妙平衡偏差与方差&#xff0c;成为PP…...

MX28智能舵机RS485底层驱动开发实战

1. MX28智能舵机底层驱动技术解析&#xff1a;基于RS485总线的嵌入式控制实现1.1 技术定位与工程价值MX28是Robotis公司推出的第二代高精度智能舵机&#xff08;Smart Actuator&#xff09;&#xff0c;采用RS485半双工差分总线通信&#xff0c;支持位置、速度、扭矩闭环控制及…...

图像转3D模型:零基础制作个性化浮雕的完整指南

图像转3D模型&#xff1a;零基础制作个性化浮雕的完整指南 【免费下载链接】ImageToSTL This tool allows you to easily convert any image into a 3D print-ready STL model. The surface of the model will display the image when illuminated from the left side. 项目地…...

计算机毕设 java 基于 BS 的驾校在线学习考试系统 SpringBoot 驾校在线学习与考试管理平台 JavaWeb 驾校理论学习与模拟考试系统

计算机毕设 java 基于 BS 的驾校在线学习考试系统 43i2x9&#xff0c;末尾的数字和英文也要加上 &#xff08;配套有源码 程序 mysql 数据库 论文&#xff09;本套源码可以先看具体功能演示视频领取&#xff0c;文末有联 xi 可分享随着驾考需求的不断增长&#xff0c;传统驾校理…...

Spring Boot实战:5分钟搞定CORS跨域配置(含@CrossOrigin详解)

Spring Boot实战&#xff1a;5分钟搞定CORS跨域配置&#xff08;含CrossOrigin详解&#xff09; 现代Web开发中&#xff0c;前后端分离架构已成为主流选择。这种架构下&#xff0c;前端应用运行在一个域名下&#xff0c;而后端API服务则部署在另一个域名。当浏览器尝试从前端向…...

Stable-Diffusion-v1-5-archive多分辨率实践:512×512 vs 768×768出图质量与耗时对比

Stable-Diffusion-v1-5-archive多分辨率实践&#xff1a;512512 vs 768768出图质量与耗时对比 你是不是也好奇&#xff0c;用Stable Diffusion出图时&#xff0c;分辨率到底该怎么选&#xff1f;是选经典的512512&#xff0c;还是追求更高清的768768&#xff1f;选高了怕电脑跑…...

从零开始手搓一个xv6内核页表:跟着MIT 6.S081源码一步步理解虚拟内存初始化

从零构建xv6内核页表&#xff1a;深入解析RISC-V虚拟内存初始化实战 在MIT 6.S081操作系统的学习过程中&#xff0c;xv6作为教学用精简内核&#xff0c;其虚拟内存实现是理解现代计算机内存管理的关键。本文将带您从第一行代码开始&#xff0c;完整复现xv6内核页表的构建过程&…...

颠覆传统系统管理的轻量级工具:NSudo如何重新定义权限操作

颠覆传统系统管理的轻量级工具&#xff1a;NSudo如何重新定义权限操作 【免费下载链接】NSudo [Deprecated, work in progress alternative: https://github.com/M2Team/NanaRun] Series of System Administration Tools 项目地址: https://gitcode.com/gh_mirrors/ns/NSudo …...