浏览代码

查询管点管线

gushoubang 1 年之前
父节点
当前提交
b3b870cf41

+ 9 - 3
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/controller/gw/GwController.java

@@ -1,12 +1,13 @@
 package com.onemap.apply.controller.gw;
 
 import com.onemap.apply.service.gw.GwService;
-import com.onemap.common.core.web.domain.MsgResult;
 import com.onemap.common.core.web.domain.RequestResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
 import java.util.Map;
 
 @RestController
@@ -16,9 +17,14 @@ public class GwController {
     GwService gwService;
 
     @RequestMapping("/GetInfo")
-    public RequestResult GetList(Integer type, String key) {
+    public RequestResult GetList(@Valid @NotNull Integer type, String key) {
+        if (type != null && (type != 1 && type != 2)) {
+            return RequestResult.error("查询类型错误");
+        }
         Map<String, Object> data = gwService.getData(type, key);
-
+        if(data==null){
+            return RequestResult.error("查询失败");
+        }
         return RequestResult.success("查询成功", data);
     }
 }

+ 1 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gw/GdMapper.java

@@ -6,5 +6,5 @@ import com.onemap.apply.domain.gw.GdDTO;
 import java.util.Map;
 
 public interface GdMapper extends BaseMapper<GdDTO> {
-    Map<String, Object> getInfo(String pointName);
+    Map<String, Object> getInfo(String key);
 }

+ 11 - 0
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/mapper/gw/GxMapper.java

@@ -0,0 +1,11 @@
+package com.onemap.apply.mapper.gw;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.onemap.apply.domain.gw.GdDTO;
+import com.onemap.apply.domain.gw.GxDTO;
+
+import java.util.Map;
+
+public interface GxMapper extends BaseMapper<GxDTO> {
+    Map<String, Object> getInfo(String key);
+}

+ 4 - 1
onemap-modules/onemap-apply/src/main/java/com/onemap/apply/service/impl/gw/GwServiceImpl.java

@@ -1,6 +1,7 @@
 package com.onemap.apply.service.impl.gw;
 
 import com.onemap.apply.mapper.gw.GdMapper;
+import com.onemap.apply.mapper.gw.GxMapper;
 import com.onemap.apply.service.gw.GwService;
 import com.onemap.common.datasource.annotation.Slave;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -13,6 +14,8 @@ import java.util.Map;
 public class GwServiceImpl implements GwService {
     @Autowired(required = false)
     GdMapper gdMapper;
+    @Autowired(required = false)
+    GxMapper gxMapper;
 
     @Override
 
@@ -22,9 +25,9 @@ public class GwServiceImpl implements GwService {
         if (type == 1) {
             // 管点
             map = gdMapper.getInfo(param);
-            System.out.println(map);
         } else {
             // 管线
+            map = gxMapper.getInfo(param);
         }
         return map;
     }

+ 1 - 1
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gw/GdMapper.xml

@@ -11,6 +11,6 @@
     <select id="getInfo" resultType="Map">
         SELECT *
         FROM "GD"
-        WHERE pointname = #{pointName}
+        WHERE pointname = #{key}
     </select>
 </mapper>

+ 16 - 0
onemap-modules/onemap-apply/src/main/resources/mapper/postgresql/gw/GxMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.onemap.apply.mapper.gw.GxMapper">
+
+    <!-- 可根据自己的需求,是否要使用 -->
+    <resultMap type="com.onemap.apply.domain.gw.GxDTO" id="tGdMap">
+
+    </resultMap>
+
+    <select id="getInfo" resultType="Map">
+        SELECT *
+        FROM "GX"
+        WHERE "管线段" = #{key}
+    </select>
+</mapper>