Explorar el Código

1.增加海域全选历史轨迹查询接口shipName字段

liangjianf hace 2 años
padre
commit
91e91f19b0

+ 1 - 0
beidou-ship/src/main/java/cn/com/taiji/beidou/ship/track/domain/ShipContainsResult.java

@@ -14,4 +14,5 @@ public class ShipContainsResult {
     private String longitude;
     private String latitude;
     private String location;
+    private String shipName;
 }

+ 8 - 2
beidou-ship/src/main/resources/mapper/ShipTrackMapper.xml

@@ -18,6 +18,7 @@
         <result property="deviceId" column="device_id"/>
         <result property="longitude" column="longitude"/>
         <result property="latitude" column="latitude"/>
+        <result property="shipName" column="shipName"/>
     </resultMap>
 
     <select id="selectShipTrackDetail" parameterType="shipTrackReq" resultMap="shipTrackResult">
@@ -28,11 +29,16 @@
         order by track.location_time DESC
     </select>
     <select id="selectShipContainsResults" parameterType="ShipContainsReq" resultMap="ShipContainsResult">
-        SELECT device_id,longitude,latitude FROM (
+        SELECT a.device_id,
+               a.longitude,
+               a.latitude,
+               b.ship_id as shipName FROM (
         SELECT  device_id,longitude,latitude,
                 ROW_NUMBER() OVER(PARTITION BY device_id ORDER BY location_time desc) AS SCORE_ROWNUMBER
         from ax_beidou_track where location_time BETWEEN #{startTime} and #{endTime}
         and ST_Contains(st_geometryfromtext(#{wkt}),st_point(longitude,latitude))=1
-        ) T1 WHERE T1.SCORE_ROWNUMBER = 1
+        ) a
+        INNER JOIN ax_beidou_ship_archives b ON a.device_id = b.devide_no
+        WHERE a.SCORE_ROWNUMBER = 1
     </select>
 </mapper>