Vacity há 7 anos atrás
pai
commit
5b41920fd8

+ 25 - 0
.gitignore

@@ -0,0 +1,25 @@
+/target/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+.sts4-cache
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+/nbproject/private/
+/nbbuild/
+/dist/
+/nbdist/
+/.nb-gradle/
+/build/

+ 15 - 0
src/main/java/com/example/cinema/bl/HallService.java

@@ -0,0 +1,15 @@
+package com.example.cinema.bl;
+
+import com.example.cinema.vo.ResponseVO;
+
+/**
+ * @author fjj
+ * @date 2019/4/12 2:01 PM
+ */
+public interface HallService {
+    /**
+     * 搜索所有影厅
+     * @return
+     */
+    ResponseVO searchAllHall();
+}

+ 25 - 0
src/main/java/com/example/cinema/bl/HallServiceImpl.java

@@ -0,0 +1,25 @@
+package com.example.cinema.bl;
+
+import com.example.cinema.data.HallMapper;
+import com.example.cinema.vo.ResponseVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * @author fjj
+ * @date 2019/4/12 2:01 PM
+ */
+@Service
+public class HallServiceImpl implements HallService {
+    @Autowired
+    private HallMapper hallMapper;
+    @Override
+    public ResponseVO searchAllHall() {
+        try {
+            return ResponseVO.buildSuccess(hallMapper.selectAllHall());
+        } catch (Exception e) {
+            e.printStackTrace();
+            return ResponseVO.buildFailure("失败");
+        }
+    }
+}

+ 23 - 0
src/main/java/com/example/cinema/controller/HallController.java

@@ -0,0 +1,23 @@
+package com.example.cinema.controller;
+
+import com.example.cinema.bl.HallService;
+import com.example.cinema.vo.ResponseVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @author fjj
+ * @date 2019/4/12 1:59 PM
+ */
+@RestController
+public class HallController {
+    @Autowired
+    private HallService hallService;
+
+    @RequestMapping(value = "hall/all", method = RequestMethod.GET)
+    public ResponseVO searchAllHall(){
+        return hallService.searchAllHall();
+    }
+}