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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/608761.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

人工智能任务2-读懂Transformer模型的十个灵魂拷问问题,深度理解Transformer模型架构

大家好&#xff0c;我是微学AI&#xff0c;今天给大家介绍一下人工智能任务2-读懂Transformer模型的十个灵魂拷问问题&#xff0c;深度理解Transformer模型架构。Transformer模型是一种基于自注意力机制的神经网络架构&#xff0c;被广泛用于自然语言处理任务中&#xff0c;如机…

系分笔记数据库技术之数据库安全措施

文章目录 1、概要2、数据库的保护措施3、数据库的故障4、备份和日志5、总结 1、概要 数据库设计是考试重点&#xff0c;常考和必考内容&#xff0c;本篇主要记录了知识点&#xff1a;数据库故障及解决、数据库安全保护措施和数据库备份及恢复。 2、数据库的保护措施 数据库安全…

云卷云舒:【实战篇】云主机/虚拟机迁移

1. 简介 用户原有业务通过不同版本型号、不同操作系统的主机承载&#xff0c;形式上包括物理服务器、虚拟机、公有云主机等。随着业务不断扩张&#xff0c;需要将其业务云化转型&#xff0c;必须保证上云过程数据完整&#xff0c;业务平滑过度。 如果将所有业务系统都重新部署…

以太坊开发者会议回顾:坎昆升级、硬分叉与布拉格

作者&#xff1a;Christine Kim Galaxy研究副总裁 编译&#xff1a;秦晋 碳链价值 2024年1月4日&#xff0c;以太坊开发人员齐聚Zoom for All Core Developers Execution (ACDE) Call #178 上。ACDE电话会议通常由以太坊基金会协议负责人Tim Beiko主持&#xff0c;是一个开发人…

Orchestrator源码解读2-故障失败发现

目录 目录 前言 核心流程函数调用路径 GetReplicationAnalysis 故障类型和对应的处理函数 拓扑结构警告类型 与MHA相比 前言 Orchestrator另外一个重要的功能是监控集群&#xff0c;发现故障。根据从复制拓扑本身获得的信息&#xff0c;它可以识别各种故障场景。Orchest…

Apollo基础 - Frenet坐标系

Frenet与笛卡尔坐标系的转换详细推导见&#xff1a;b站老王 自动驾驶决策规划学习记录&#xff08;四&#xff09; Apollo相关代码&#xff1a; modules/common/math/cartesian_frenet_conversion.h #pragma once #include <array> #include "modules/common/mat…

怎么一边讲PPT一边录视频 如何一边录制PPT一边录制人像 录屏软件免费录屏 PPT录制怎么录制

随着新媒体技术的发展&#xff0c;短视频和直播越来越火。越来越多的小伙伴加入了视频制作的大军&#xff0c;那么你想知道怎么一边讲PPT一边录视频&#xff0c;如何一边录制PPT一边录制人像吗&#xff1f; 一、怎么一边讲PPT一边录视频 我们可以借助PPT本身自带的屏幕录制功能…

Linux的发展历程:从诞生到全球应用

一、前言 Linux作为一个开源操作系统&#xff0c;经历了令人瞩目的发展历程。从最初的创意到如今在全球范围内得到广泛应用&#xff0c;Linux不仅是技术的杰出代表&#xff0c;更是开源精神的典范。本文将追溯Linux的发展历程&#xff0c;深入了解它是如何从一个个人项目演变为…

【docker笔记】Docker容器数据卷

Docker容器数据卷 卷就是目录或者文件&#xff0c;存在于一个或多个容器中&#xff0c;由docker挂载到容器&#xff0c;但不属于联合文件系统&#xff0c;因此能够绕过Union File System提供一些用于持续存储或共享数据的特性 卷的设计目的就是数据的持久化&#xff0c;完全独…

VMware Workstation安装以及配置模板机

文章目录 一、VMware Workstation软件下载安装1、下载2、安装 二、CentOS7模板机安装1、创建虚拟机2、安装系统 三、网络配置 一、VMware Workstation软件下载安装 1、下载 下载地址&#xff1a;https://download3.vmware.com/software/wkst/file/VMware-workstation-full-15…

css中的变量和辅助函数

变量 --name 两个破折号加变量名称&#xff08;可以在当前的选择器内定义&#xff09;var(--*) 命名规则 body {--深蓝: #369;background-color: var(--深蓝); } 变量值只能做用属性值&#xff0c;不能用做属性名。变量命名不能包含 $,[,^,(,% 等字符 普通字符局限在只要是数…

软件测试|MySQL逻辑运算符使用详解

简介 在MySQL中&#xff0c;逻辑运算符用于处理布尔类型的数据&#xff0c;进行逻辑判断和组合条件。逻辑运算符主要包括AND、OR、NOT三种&#xff0c;它们可以帮助我们在查询和条件语句中进行复杂的逻辑操作。本文将详细介绍MySQL中逻辑运算符的使用方法和示例。 AND运算符 …

邮政快递单号查询入口,对快递单号进行提前签收分析

一款优秀的快递单号筛选软件能够给你的工作和生活带来极大的便利。通过合理选择和使用该软件&#xff0c;你将能够轻松管理、高效筛选快递单号&#xff0c;提升工作效率和生活品质。不妨试试我们的【快递批量查询高手】&#xff0c;让你的物流管理更加智能、便捷&#xff01; …

Pytest成魔之路 —— fixture 之大解剖!

1. 简介 fixture是pytest的一个闪光点&#xff0c;pytest要精通怎么能不学习fixture呢&#xff1f;跟着我一起深入学习fixture吧。其实unittest和nose都支持fixture&#xff0c;但是pytest做得更炫。 fixture是pytest特有的功能&#xff0c;它用pytest.fixture标识&#xff0c…

【算法Hot100系列】搜索插入位置

💝💝💝欢迎来到我的博客,很高兴能够在这里和您见面!希望您在这里可以感受到一份轻松愉快的氛围,不仅可以获得有趣的内容和知识,也可以畅所欲言、分享您的想法和见解。 推荐:kwan 的首页,持续学习,不断总结,共同进步,活到老学到老导航 檀越剑指大厂系列:全面总结 jav…

运用AI翻译漫画(二)

构建代码 构建这个PC桌面应用&#xff0c;我们需要几个步骤&#xff1a; 在得到第一次的显示结果后&#xff0c;经过测试&#xff0c;有很大可能会根据结果再对界面进行调整&#xff0c;实际上也是一个局部的软件工程中的迭代开发。 界面设计 启动Visual Studio 2017, 创建…

并发程序设计--D10线程池及gdb调试多线程

线程池 概念&#xff1a; 通俗的讲就是一个线程的池子&#xff0c;可以循环的完成任务的一组线程集合 必要性&#xff1a; 我们平时创建一个线程&#xff0c;完成某一个任务&#xff0c;等待线程的退出。但当需要创建大量的线程时&#xff0c;假设T1为创建线程时间&#xf…

贯穿设计模式-中介模式+模版模式

样例代码 涉及到的项目样例代码均可以从https://github.com/WeiXiao-Hyy/Design-Patterns.git获取 需求 购买商品时会存在着朋友代付的场景&#xff0c;可以抽象为购买者&#xff0c;支付者和中介者之间的关系 -> 中介者模式下单&#xff0c;支付&#xff0c;发货&#xff0…

什么是软件测试

一、软件测试的定义 软件测试的经典定义是在规定条件下对程序进行操作&#xff0c;以发现错误&#xff0c;对软件质量进行评估。因为软件是由文档、数据以及程序组成的&#xff0c;所以软件测试的对象也就不仅仅是程序本身&#xff0c;而是包括软件形成过程的文档、数据以及程…

什么是博若莱新酒节?

在红酒圈儿里混&#xff0c;一定不能不知道博若莱新酒节&#xff0c;这是法国举世闻名的以酒为主题的重要节日之一。现已成为世界范围内庆祝当年葡萄收获和酿制的节日&#xff0c;被称为一年一度的酒迷盛会。 云仓酒庄的品牌雷盛红酒LEESON分享博若莱位于法国勃艮第南部&#x…