use of com.mapper.MovieMapper in project Movie by batsqd.
the class MovieInfoService method getCountMoviesByGenres.
public int getCountMoviesByGenres(String movie_genres) {
ApplicationContext ac = ApplicationContextUtil.getApplicationContext();
MovieMapper movieMapper = (MovieMapper) ac.getBean("movieMapper");
int countMoviesByGenres = movieMapper.selectCountMoviesByGenres(movie_genres);
return countMoviesByGenres;
}
use of com.mapper.MovieMapper 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;
}
use of com.mapper.MovieMapper in project Movie by batsqd.
the class SpringMybatis method main.
public static void main(String[] args) {
// TODO Auto-generated method stub
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
MovieMapper movieMapper = (MovieMapper) ac.getBean("movieMapper");
System.out.println(movieMapper.selectMovieById(2));
UserMapper userMapper = (UserMapper) ac.getBean("userMapper");
User user = userMapper.selectUserByUsername("yzy");
System.out.print(user);
}
use of com.mapper.MovieMapper 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;
}
use of com.mapper.MovieMapper 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;
}
Aggregations