项目运行截图
修改电影
后台登陆
添加电影
动态信息
网址管理
友情链接
首页信息
收录电影
电影详情
详细信息
动态列表
技术描述
开发工具: Idea/Eclipse
数据库: mysql
Jar包仓库: Maven
前段框架:jquery/Jsp
后端框架: Spring+SpringMVC+Mybatis+SpringBoot
资料说明
基于SpringBoot+Spring+SpringMVC+JPA+Shiro+MySQL的电影影院推荐系统,首页信息展示,电影查询,电影动态管理,电影管理,网站链接管理,添加电影等功能。
/**
* 电影控制器
* @author Administrator
*
*/
@Controller
@RequestMapping(value = "/film")
public class FilmController {
@Resource
private FilmService filmService;
@Resource
private WebSiteInfoService webSiteInfoService;
/**
* 搜索电影 简单模糊查询
* @param q
* @return
* @throws Exception
*/
@RequestMapping("/search")
public ModelAndView search(@Valid Film film,BindingResult bindingResult)throws Exception{
ModelAndView mav=new ModelAndView();
if(bindingResult.hasErrors()){
mav.addObject("error", bindingResult.getFieldError().getDefaultMessage());
mav.addObject("title", "首页");
mav.addObject("mainPage", "film/indexFilm");
mav.addObject("mainPageKey", "#f");
mav.addObject("film", film);
mav.setViewName("index");
}else{
List<Film> filmList=filmService.list(film, 1, 32);
mav.addObject("filmList", filmList); // 最多查询32条数据
mav.addObject("title", film.getName());
mav.addObject("mainPage", "film/result");
mav.addObject("mainPageKey", "#f");
mav.addObject("film", film);
mav.addObject("total", filmList.size());
mav.setViewName("index");
}
return mav;
}
/**
* 分页查询电影信息
* @return
* @throws Exception
*/
@RequestMapping("/list/{id}")
public ModelAndView list(@PathVariable(value="id",required=false) Integer page)throws Exception{
ModelAndView mav=new ModelAndView();
List<Film> filmList=filmService.list(null, page, 20);
Long total=filmService.getCount(null);
mav.addObject("filmList", filmList);
mav.addObject("pageCode",PageUtil.genPagination("/film/list", total, page, 20));
mav.addObject("title", "电影列表");
mav.addObject("mainPage", "film/list");
mav.addObject("mainPageKey", "#f");
mav.setViewName("index");
return mav;
}
/**
* 根据id查询电影详细信息
* @return
* @throws Exception
*/
@RequestMapping("/{id}")
public ModelAndView view(@PathVariable("id") Integer id)throws Exception{
ModelAndView mav=new ModelAndView();
Film film=filmService.findById(id);
mav.addObject("film", film);
mav.addObject("title", film.getTitle());
mav.addObject("pageCode", this.genUpAndDownPageCode(filmService.getLast(id),filmService.getNext(id)));
mav.addObject("randomFilmList", filmService.randomList(8));
mav.addObject("webSiteInfoList", webSiteInfoService.getByFilmId(id));
mav.addObject("mainPage", "film/view");
mav.addObject("mainPageKey", "#f");
mav.addObject("film", film);
mav.setViewName("index");
return mav;
}
/**
* 获取下一篇博客和下一篇博客代码
* @param lastBlog
* @param nextBlog
* @return
*/
private String genUpAndDownPageCode(Film lastFilm,Film nextFilm){
StringBuffer pageCode=new StringBuffer();
if(lastFilm==null || lastFilm.getId()==null){
pageCode.append("<p>上一篇:没有了</p>");
}else{
pageCode.append("<p>上一篇:<a href='/film/"+lastFilm.getId()+"'>"+lastFilm.getTitle()+"</a></p>");
}
if(nextFilm==null || nextFilm.getId()==null){
pageCode.append("<p>下一篇:没有了</p>");
}else{
pageCode.append("<p>下一篇:<a href='/film/"+nextFilm.getId()+"'>"+nextFilm.getTitle()+"</a></p>");
}
return pageCode.toString();
}
}