| | |
| | | <select id="selectReceivingTestIds" resultType="long"> |
| | | select test_id from t_test where del_flag = 0 and reception_status = 'RECEIVING' order by test_id |
| | | </select> |
| | | <insert id="insertRealtimeSnapshot"> |
| | | insert ignore into t_test_realtime_snapshot |
| | | (test_id, binding_id, channel_id, collector_id, capture_slot_utc, |
| | | cabinet_sequence_id, cabinet_device_time_utc, cabinet_device_time_raw, |
| | | collector_sequence_id, collector_device_time_utc, collector_device_time_raw, |
| | | server_received_at_utc, cycle_no, step_no, step_type, step_name, |
| | | voltage_v, current_a, capacity_ah, energy_wh, temperature, positive_potential, |
| | | negative_potential, extension_measurements_json, content_sha256) |
| | | values (#{testId}, #{bindingId}, #{channelId}, #{collectorId}, #{captureSlotUtc}, |
| | | #{cabinetSequenceId}, #{cabinetDeviceTimeUtc}, #{cabinetDeviceTimeRaw}, |
| | | #{collectorSequenceId}, #{collectorDeviceTimeUtc}, #{collectorDeviceTimeRaw}, |
| | | #{serverReceivedAtUtc}, #{cycleNo}, #{stepNo}, #{stepType}, #{stepName}, |
| | | #{voltageV}, #{currentA}, #{capacityAh}, #{energyWh}, #{temperature}, #{positivePotential}, |
| | | #{negativePotential}, #{extensionMeasurementsJson}, #{contentSha256}) |
| | | </insert> |
| | | <select id="selectPersistedRealtimeSnapshots" resultType="map"> |
| | | select concat('snapshot:', snapshot.snapshot_id) id, |
| | | concat('snapshot:', snapshot.snapshot_id) stableIdentity, |
| | | concat('RS-', snapshot.snapshot_id) recordNo, |
| | | 'SNAPSHOT' sourceType, battery.battery_no batteryNo, |
| | | snapshot.cycle_no cycleNo, snapshot.step_no stepNo, snapshot.step_name stepName, |
| | | snapshot.cabinet_sequence_id sequenceId, |
| | | snapshot.cabinet_device_time_utc recordedAt, snapshot.cabinet_device_time_utc absoluteTime, |
| | | snapshot.cabinet_device_time_utc deviceTime, snapshot.server_received_at_utc serverReceivedAt, |
| | | snapshot.snapshot_id snapshotId, |
| | | snapshot.temperature temperature, snapshot.positive_potential positivePotential, |
| | | snapshot.negative_potential negativePotential, |
| | | snapshot.voltage_v voltage, snapshot.current_a current, |
| | | snapshot.capacity_ah capacity, snapshot.energy_wh energy, |
| | | channel.adapter_id adapterId, channel.adapter_code adapterCode, |
| | | channel.devtype devtype, channel.devid deviceId, channel.subdevid subdevid, channel.chlid channelId, |
| | | collector.collector_id collectorId, collector.collector_code collectorCode, |
| | | snapshot.extension_measurements_json extensionMeasurementsJson |
| | | from t_test_realtime_snapshot snapshot |
| | | join t_test_channel_binding binding on binding.binding_id = snapshot.binding_id |
| | | join t_test_battery battery on battery.relation_id = binding.battery_relation_id and battery.del_flag = 0 |
| | | join t_detection_channel channel on channel.channel_id = snapshot.channel_id and channel.del_flag = 0 |
| | | join t_collector collector on collector.collector_id = snapshot.collector_id |
| | | where snapshot.test_id = #{testId} |
| | | order by snapshot.capture_slot_utc desc, snapshot.snapshot_id desc |
| | | </select> |
| | | <select id="selectPersistedRecords" resultType="map"> |
| | | select sample.sample_id id, |
| | | concat('RD-', channel.devid, '-', channel.chlid, '-', lpad(sample.seq_id, 6, '0')) recordNo, |