Преглед на файлове

处理上架下架电影的查看

jacksenma преди 7 години
родител
ревизия
0ebe9ae30c

+ 4 - 4
src/main/java/com/example/cinema/bl/MovieService.java

@@ -25,16 +25,16 @@ public interface MovieService {
     ResponseVO searchOneMovieByIdAndUserId(int id, int userId);
 
     /**
-     * 搜索全部电影(影院方查看)
+     * 搜索全部电影
      * @return
      */
-    ResponseVO searchAllMovieCinema();
+    ResponseVO searchAllMovie();
 
     /**
-     * 搜索全部电影(观众查看)
+     * 搜索全部电影(不包括已经下架的)
      * @return
      */
-    ResponseVO searchAllMovieAudience();
+    ResponseVO searchOtherMoviesExcludeOff();
 
     /**
      * 想看电影

+ 5 - 5
src/main/java/com/example/cinema/blImpl/MovieServiceImpl.java

@@ -65,9 +65,9 @@ public class MovieServiceImpl implements MovieService {
     }
 
     @Override
-    public ResponseVO searchAllMovieCinema() {
+    public ResponseVO searchAllMovie() {
         try {
-            return ResponseVO.buildSuccess(movieMapper.selectAllMovieCinema());
+            return ResponseVO.buildSuccess(movieMapper.selectAllMovie());
         } catch (Exception e) {
             e.printStackTrace();
             return ResponseVO.buildFailure("失败");
@@ -75,9 +75,9 @@ public class MovieServiceImpl implements MovieService {
     }
 
     @Override
-    public ResponseVO searchAllMovieAudience() {
+    public ResponseVO searchOtherMoviesExcludeOff() {
         try {
-            return ResponseVO.buildSuccess(movieMapper.selectAllMovieAudience());
+            return ResponseVO.buildSuccess(movieMapper.selectOtherMoviesExcludeOff());
         } catch (Exception e) {
             e.printStackTrace();
             return ResponseVO.buildFailure("失败");
@@ -130,7 +130,7 @@ public class MovieServiceImpl implements MovieService {
     @Override
     public ResponseVO getMovieByKeyword(String keyword) {
         if (keyword==null||keyword.equals(""))
-            return ResponseVO.buildSuccess(movieMapper.selectAllMovieCinema());
+            return ResponseVO.buildSuccess(movieMapper.selectAllMovie());
         return ResponseVO.buildSuccess(movieMapper.selectMovieByKeyword(keyword));
     }
 

+ 8 - 8
src/main/java/com/example/cinema/controller/MovieController.java

@@ -27,16 +27,16 @@ public class MovieController {
         return movieService.searchOneMovieByIdAndUserId(id, userId);
     }
 
-    @RequestMapping(value = "/movie/all/cinema", method = RequestMethod.GET)
-    public ResponseVO searchAllMovieCinema(){
-        //返回结果中包括已经下架的电影,用于影院方查看电影列表
-        return movieService.searchAllMovieCinema();
+    @RequestMapping(value = "/movie/all", method = RequestMethod.GET)
+    public ResponseVO searchAllMovie(){
+        //返回结果中包括已经下架的电影
+        return movieService.searchAllMovie();
     }
 
-    @RequestMapping(value = "/movie/all/audience", method = RequestMethod.GET)
-    public ResponseVO searchAllMovieAudience(){
-        //返回结果中不包括已经下架的电影,主要用于观众查看以及影院查看可供排片的所有电影
-        return movieService.searchAllMovieAudience();
+    @RequestMapping(value = "/movie/all/exclude/off", method = RequestMethod.GET)
+    public ResponseVO searchOtherMoviesExcludeOff(){
+        //返回结果中不包括已经下架的电影
+        return movieService.searchOtherMoviesExcludeOff();
     }
 
 

+ 4 - 4
src/main/java/com/example/cinema/data/MovieMapper.java

@@ -36,16 +36,16 @@ public interface MovieMapper {
     MovieVO selectMovieByIdAndUserId(@Param("id") int id, @Param("userId") int userId);
 
     /**
-     * 展示所有电影(影院方)
+     * 展示所有电影
      * @return
      */
-    List<MovieVO> selectAllMovieCinema();
+    List<MovieVO> selectAllMovie();
 
     /**
-     * 展示所有电影(观众)
+     * 展示所有电影(不包括已经下架的)
      * @return
      */
-    List<MovieVO> selectAllMovieAudience();
+    List<MovieVO> selectOtherMoviesExcludeOff();
 
     /**
      * 根据关键字搜索电影

+ 2 - 2
src/main/java/com/example/cinema/data/MovieMapper.xml

@@ -16,7 +16,7 @@
         left join (select l.movie_id as id, count(*) as likeCount from movie_like l where l.movie_id = #{id}) b on a.id = b.id
     </select>
 
-    <select id="selectAllMovieCinema" resultMap="Movie">
+    <select id="selectAllMovie" resultMap="Movie">
         select * from movie m
         left join
         (select l.movie_id, count(*) as likeCount from movie_like l group by l.movie_id) l
@@ -24,7 +24,7 @@
         order by m.start_date asc
     </select>
 
-    <select id="selectAllMovieAudience" resultMap="Movie">
+    <select id="selectOtherMoviesExcludeOff" resultMap="Movie">
         select * from
         (select * from movie where movie.status = 0) m
         left join