use of com.mapper.MovieMapper 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.mapper.MovieMapper 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.mapper.MovieMapper in project Movie by batsqd.
the class MovieInfoService method getPageCountByGenres.
public int getPageCountByGenres(int pageSize, String movie_genres) {
ApplicationContext ac = ApplicationContextUtil.getApplicationContext();
MovieMapper movieMapper = (MovieMapper) ac.getBean("movieMapper");
int countMovies = movieMapper.selectCountMoviesByGenres("%" + movie_genres + "%");
int pageCount = countMovies % 12 == 0 ? countMovies / 12 : (countMovies / 12) + 1;
return pageCount;
}
use of com.mapper.MovieMapper 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;
}
Aggregations