gao.qiang hai 1 ano
pai
achega
72ff5c7dab

+ 5 - 5
business-service/src/main/resources/mapper/VehiclePositionMapper.xml

@@ -46,6 +46,11 @@
         SELECT /*+ GROUP_OPT_FLAG(1)*/ pos.*, ter.terminal_name AS terminalName, ter.status AS sta
         FROM vehicle_position pos
         RIGHT JOIN base_terminal ter ON pos.terminal_code = ter.terminal_code
+        AND pos.create_time = (
+        SELECT MAX(create_time)
+        FROM vehicle_position
+        WHERE terminal_code = ter.terminal_code
+        )
         <where>
             <if test="terminalCode != null and terminalCode != ''">
                 AND ter.terminal_code = #{terminalCode}
@@ -57,11 +62,6 @@
                 AND ter.status = #{status}
             </if>
         </where>
-        AND pos.create_time = (
-        SELECT MAX(create_time)
-        FROM vehicle_position
-        WHERE terminal_code = ter.terminal_code
-        )
         GROUP BY ter.terminal_code
         ORDER BY pos.create_time
     </select>