use of com.po.Movie in project Movie by batsqd.
the class MovieController method getMovieDetail.
@RequestMapping("getMovieDetail.action")
public ModelAndView getMovieDetail(int movie_id, HttpSession session) {
ArrayList<Movie> moviesList = new ArrayList<Movie>();
ApplicationContext ac = ApplicationContextUtil.getApplicationContext();
MovieMapper movieMapper = (MovieMapper) ac.getBean("movieMapper");
Movie movie = movieMapper.selectMovieById(movie_id);
ModelAndView modelAndView = new ModelAndView();
session.setAttribute("movieDetail", movie);
//modelAndView.addObject("movieDetail", movie);
modelAndView.setViewName("/WEB-INF/jsp/movieDetail.jsp");
return modelAndView;
}
use of com.po.Movie in project Movie by batsqd.
the class TestMybatis method main.
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
String resource = "SqlMapConfig.xml";
InputStream inputStream = Resources.getResourceAsStream(resource);
SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
SqlSession sqlSession = sqlSessionFactory.openSession();
MovieMapper movieMapper = sqlSession.getMapper(MovieMapper.class);
Movie movie = movieMapper.selectMovieById(3);
System.out.println(movie.toString());
}
use of com.po.Movie in project Movie by batsqd.
the class TestSpring method main.
public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
Movie movie = (Movie) ac.getBean("movie");
System.out.println("电影名:" + movie.getMovie_name());
}
use of com.po.Movie in project Movie by batsqd.
the class MovieInfoService method getMoviesOrderByRatingToPage.
public ArrayList<Movie> getMoviesOrderByRatingToPage(String movie_genres, int begain, int end) {
ApplicationContext ac = ApplicationContextUtil.getApplicationContext();
MovieMapper movieMapper = (MovieMapper) ac.getBean("movieMapper");
HashMap<String, Object> parameter = new HashMap<String, Object>();
parameter.put("movie_genres", "%" + movie_genres + "%");
parameter.put("begain", begain);
parameter.put("end", end);
ArrayList<Movie> moviesList = movieMapper.selectMoviesByRatingLimit(parameter);
return moviesList;
}
use of com.po.Movie in project Movie by batsqd.
the class FenyeController method getMoviesByPage.
@RequestMapping("/getMoviesByPage.action")
public ModelAndView getMoviesByPage(int pageNow, String type, String genres) {
//pageNow是指用户从所看到的页面的那页
int pageSize = 12;
int pageCount = 1;
int begain = 0;
int end = 5;
begain = (pageNow) * pageSize;
end = begain + pageSize;
ArrayList<Movie> moviesList = new ArrayList<Movie>();
MovieInfoService movieInfoService = new MovieInfoService();
if ("byGenres".equals(type)) {
moviesList = movieInfoService.getMoviesByGenresToPage(genres, begain, end);
pageCount = movieInfoService.getPageCountByGenres(pageSize, genres);
} else if ("byReleaseTime".equals(type)) {
moviesList = movieInfoService.getMoviesOrderByReleaseTimeToPage(genres, begain, end);
pageCount = movieInfoService.getPageCountByGenres(pageSize, genres);
} else if ("byRating".equals(type)) {
moviesList = movieInfoService.getMoviesOrderByRatingToPage(genres, begain, end);
pageCount = movieInfoService.getPageCountByGenres(pageSize, genres);
}
ModelAndView modelAndView = new ModelAndView();
String navigationUrlPre = "";
String navigationUrlNext = "";
if (pageNow < 1) {
//没有上一页;
navigationUrlPre = "";
} else {
//有上一页
/*http://121.42.174.147:8080
navigationUrlPre="<a href='http://yuanzhiyuan-pc:8080/Movie/getMoviesByPage.action?pageNow="+(pageNow-1)+"&type="+type+"&genres="+genres+"'>上一页</a>";
*/
navigationUrlPre = "<a href='http://yuanzhiyuan-pc:8080/Movie/getMoviesByPage.action?pageNow=" + (pageNow - 1) + "&type=" + type + "&genres=" + genres + "'>上一页</a>";
}
if (pageNow + 1 < pageCount) {
//有下一页
navigationUrlNext = "<a href='http://yuanzhiyuan-pc:8080/Movie/getMoviesByPage.action?pageNow=" + (pageNow + 1) + "&type=" + type + "&genres=" + genres + "'>下一页</a>";
} else {
//没有下一页
navigationUrlNext = "";
}
modelAndView.addObject("genres", genres);
modelAndView.addObject("moviesList", moviesList);
modelAndView.addObject("navigation", "当前为第" + (pageNow + 1) + "页 " + navigationUrlPre + " " + navigationUrlNext + " " + " 共" + pageCount + "页!");
modelAndView.setViewName("/WEB-INF/jsp/romance.jsp");
return modelAndView;
}
Aggregations