|
@@ -127,4 +127,35 @@
|
|
|
from ax_beidou_warning_record where id = #{id} and (`start` is null or `start` != 'false')
|
|
|
</select>
|
|
|
|
|
|
+ <resultMap id="RecordByDeviceId" type="warningRecordResult">
|
|
|
+ <result property="ruleId" column="rule_id"/>
|
|
|
+ <result property="deviceId" column="device_id"/>
|
|
|
+ <result property="ruleName" column="ruleName"/>
|
|
|
+ <result property="count" column="number"/>
|
|
|
+ <collection property="records" column="{ruleId= rule_id,deviceId= device_id}"
|
|
|
+ ofType="simpleRecord" select="record">
|
|
|
+ </collection>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <select id="getRecordByDeviceId" parameterType="string" resultMap="RecordByDeviceId">
|
|
|
+ SELECT rule_id,device_id,rule.`name` as ruleName,count(*) as number
|
|
|
+ from ax_beidou_warning_record
|
|
|
+ INNER JOIN ax_beidou_warning_rule rule ON rule.id = rule_id
|
|
|
+ where device_id = #{deviceId} and (`start` is null or `start` != 'false')
|
|
|
+ and warning_time>DATE_SUB(NOW(),INTERVAL 1 DAY)
|
|
|
+ GROUP BY rule_id,rule.`name`,device_id
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="record" resultType="simpleRecord">
|
|
|
+ select record.id as warningId, warning_time as warningTime,area.name as warningDetail,
|
|
|
+ dis.id AS disposeId,location.longitude,location.latitude
|
|
|
+ from ax_beidou_warning_record record
|
|
|
+ INNER JOIN ax_beidou_ship_status sta ON record.device_id = sta.device_id
|
|
|
+ LEFT JOIN ax_beidou_ship_location location ON location.device_id = record.device_id
|
|
|
+ LEFT JOIN ax_beidou_ship_dispose dis ON record.id = dis.warning_id
|
|
|
+ LEFT JOIN ax_beidou_warning_area area ON area.id = record.area_id
|
|
|
+ where record.device_id = #{deviceId} and (record.`start` is null or record.`start` != 'false')
|
|
|
+ and record.rule_id = #{ruleId} and warning_time>DATE_SUB(NOW(),INTERVAL 1 DAY)
|
|
|
+ ORDER BY warning_time DESC
|
|
|
+ </select>
|
|
|
</mapper>
|