Search in sources :

Example 6 with Movie

use of com.po.Movie in project Movie by batsqd.

the class MovieInfoService method getMoviesOrderByReleaseTimeToPage.

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

Example 7 with Movie

use of com.po.Movie in project Movie by batsqd.

the class MovieInfoService method getMoviesBySearchKeyWordToPage.

public ArrayList<Movie> getMoviesBySearchKeyWordToPage(String keyWord, int begain, int end) {
    ApplicationContext ac = ApplicationContextUtil.getApplicationContext();
    MovieMapper movieMapper = (MovieMapper) ac.getBean("movieMapper");
    HashMap<String, Object> parameter = new HashMap<String, Object>();
    parameter.put("keyWord", "%" + keyWord + "%");
    parameter.put("begain", begain);
    parameter.put("end", end);
    ArrayList<Movie> moviesList = movieMapper.selectMoviesBySearchKeyWordLimit(parameter);
    return moviesList;
}
Also used : Movie(com.po.Movie) ApplicationContext(org.springframework.context.ApplicationContext) HashMap(java.util.HashMap) MovieMapper(com.mapper.MovieMapper)

Example 8 with Movie

use of com.po.Movie in project Movie by batsqd.

the class MovieInfoService method getMoviesByGenresToPage.

public ArrayList<Movie> getMoviesByGenresToPage(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>();
    //movie_genres
    parameter.put("movie_genres", "%" + movie_genres + "%");
    parameter.put("begain", begain);
    parameter.put("end", end);
    ArrayList<Movie> moviesList = movieMapper.selectMoviesByGenresAndLimit(parameter);
    return moviesList;
}
Also used : Movie(com.po.Movie) ApplicationContext(org.springframework.context.ApplicationContext) HashMap(java.util.HashMap) MovieMapper(com.mapper.MovieMapper)

Example 9 with Movie

use of com.po.Movie in project Movie by batsqd.

the class MovieController method getHotMovies.

@RequestMapping("getHotMovies.action")
public ModelAndView getHotMovies() {
    long l = System.currentTimeMillis();
    Date date = new Date(l);
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    String rating_time = dateFormat.format(date);
    ApplicationContext ac = ApplicationContextUtil.getApplicationContext();
    WatchMovieMapper watchMovieMapper = (WatchMovieMapper) ac.getBean("watchMovieMapper");
    HashMap<String, Object> parameter = new HashMap<String, Object>();
    parameter.put("rating_time", rating_time);
    parameter.put("hot_movie_nums", Configs.hot_movie_nums);
    ArrayList<Integer> movie_id_List = (ArrayList<Integer>) watchMovieMapper.selectHotMovies(parameter);
    MovieMapper movieMapper = (MovieMapper) ac.getBean("movieMapper");
    List<Movie> moviesList = new ArrayList<Movie>();
    for (int i = 0; i < movie_id_List.size(); i++) {
        //此处拿到movie ID 去movie表查询List<movie>
        Movie movie = movieMapper.selectMovieById(movie_id_List.get(i));
        moviesList.add(movie);
    }
    ModelAndView modelAndView = new ModelAndView();
    modelAndView.addObject("moviesList", moviesList);
    modelAndView.setViewName("/WEB-INF/jsp/hotMovies.jsp");
    return modelAndView;
}
Also used : RecommendedMovie(com.po.RecommendedMovie) Movie(com.po.Movie) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ModelAndView(org.springframework.web.servlet.ModelAndView) Date(java.sql.Date) ApplicationContext(org.springframework.context.ApplicationContext) WatchMovieMapper(com.mapper.WatchMovieMapper) SimpleDateFormat(java.text.SimpleDateFormat) MovieMapper(com.mapper.MovieMapper) WatchMovieMapper(com.mapper.WatchMovieMapper) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 10 with Movie

use of com.po.Movie in project Movie by batsqd.

the class MovieController method getMovieDetailAndCollectionFeedback.

@RequestMapping("getMovieDetailAndCollectFeedback.action")
public ModelAndView getMovieDetailAndCollectionFeedback(int movie_id, HttpSession session) {
    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/userFeedback.jsp");
    return modelAndView;
}
Also used : RecommendedMovie(com.po.RecommendedMovie) Movie(com.po.Movie) ApplicationContext(org.springframework.context.ApplicationContext) ModelAndView(org.springframework.web.servlet.ModelAndView) MovieMapper(com.mapper.MovieMapper) WatchMovieMapper(com.mapper.WatchMovieMapper) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Movie (com.po.Movie)15 MovieMapper (com.mapper.MovieMapper)10 ApplicationContext (org.springframework.context.ApplicationContext)10 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)9 ModelAndView (org.springframework.web.servlet.ModelAndView)9 ArrayList (java.util.ArrayList)7 HashMap (java.util.HashMap)6 WatchMovieMapper (com.mapper.WatchMovieMapper)5 RecommendedMovie (com.po.RecommendedMovie)5 MovieInfoService (com.service.MovieInfoService)4 RecommendMapper (com.mapper.RecommendMapper)1 User (com.po.User)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