Search in sources :

Example 11 with MovieMapper

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;
}
Also used : RecommendedMovie(com.po.RecommendedMovie) Movie(com.po.Movie) ApplicationContext(org.springframework.context.ApplicationContext) ArrayList(java.util.ArrayList) ModelAndView(org.springframework.web.servlet.ModelAndView) MovieMapper(com.mapper.MovieMapper) WatchMovieMapper(com.mapper.WatchMovieMapper) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 12 with MovieMapper

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());
}
Also used : Movie(com.po.Movie) SqlSession(org.apache.ibatis.session.SqlSession) InputStream(java.io.InputStream) SqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory) SqlSessionFactoryBuilder(org.apache.ibatis.session.SqlSessionFactoryBuilder) MovieMapper(com.mapper.MovieMapper)

Example 13 with MovieMapper

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;
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) MovieMapper(com.mapper.MovieMapper)

Example 14 with MovieMapper

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;
}
Also used : Movie(com.po.Movie) ApplicationContext(org.springframework.context.ApplicationContext) HashMap(java.util.HashMap) MovieMapper(com.mapper.MovieMapper)

Aggregations

MovieMapper (com.mapper.MovieMapper)14 ApplicationContext (org.springframework.context.ApplicationContext)13 Movie (com.po.Movie)10 HashMap (java.util.HashMap)6 WatchMovieMapper (com.mapper.WatchMovieMapper)5 RecommendedMovie (com.po.RecommendedMovie)5 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)5 ModelAndView (org.springframework.web.servlet.ModelAndView)5 ArrayList (java.util.ArrayList)4 User (com.po.User)2 RecommendMapper (com.mapper.RecommendMapper)1 UserMapper (com.mapper.UserMapper)1 ImproveSlopeOne (com.recommender.ImproveSlopeOne)1 InputStream (java.io.InputStream)1 Date (java.sql.Date)1 SimpleDateFormat (java.text.SimpleDateFormat)1 SqlSession (org.apache.ibatis.session.SqlSession)1 SqlSessionFactory (org.apache.ibatis.session.SqlSessionFactory)1 SqlSessionFactoryBuilder (org.apache.ibatis.session.SqlSessionFactoryBuilder)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1