| | |
| | | <result property="exceptionInfo" column="exception_info" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | </resultMap> |
| | | <resultMap id="TTestCollectorExceptionIntervalResultMap" type="TTestCollectorExceptionInterval"> |
| | | <id property="intervalId" column="interval_id" /> |
| | | <result property="testId" column="test_id" /> |
| | | <result property="batteryRelationId" column="battery_relation_id" /> |
| | | <result property="collectorId" column="collector_id" /> |
| | | <result property="collectorCode" column="collector_code" /> |
| | | <result property="collectorName" column="collector_name" /> |
| | | <result property="collectorChannelCode" column="collector_channel_code" /> |
| | | <result property="measurementName" column="measurement_name" /> |
| | | <result property="exceptionType" column="exception_type" /> |
| | | <result property="openedAtUtc" column="opened_at_utc" /> |
| | | <result property="missingFromUtc" column="missing_from_utc" /> |
| | | <result property="recoveredAtUtc" column="recovered_at_utc" /> |
| | | <result property="missingToUtc" column="missing_to_utc" /> |
| | | <result property="intervalStatus" column="interval_status" /> |
| | | <result property="detail" column="detail" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectTestBase"> |
| | | select t.test_id, t.test_name, t.creator_id, creator.nick_name creator_name, |
| | |
| | | update_by = #{updateBy}, update_time = #{endedAtUtc} |
| | | where test_id = #{testId} and reception_status in ('RECEIVING', 'PAUSED') and del_flag = 0 |
| | | </update> |
| | | |
| | | <select id="selectReceivingCollectorSources" resultType="com.ruoyi.system.domain.TTestCollectorSource"> |
| | | select test_fact.test_id testId, battery.relation_id batteryRelationId, battery.battery_no batteryNo, |
| | | collector.collector_id collectorId, collector.collector_code collectorCode, |
| | | mapping.channel_code channelCode |
| | | from t_test test_fact |
| | | join t_test_battery battery on battery.test_id = test_fact.test_id and battery.del_flag = 0 |
| | | join t_collector collector on collector.collector_id = battery.collector_id |
| | | and collector.del_flag = 0 |
| | | join t_test_collector_channel mapping on mapping.battery_relation_id = battery.relation_id |
| | | and mapping.test_id = test_fact.test_id |
| | | where test_fact.reception_status = 'RECEIVING' and test_fact.del_flag = 0 |
| | | order by test_fact.test_id, battery.relation_id, mapping.mapping_id |
| | | </select> |
| | | <select id="selectOpenCollectorException" resultMap="TTestCollectorExceptionIntervalResultMap"> |
| | | select * from t_test_collector_exception_interval |
| | | where test_id = #{testId} and battery_relation_id = #{batteryRelationId} |
| | | and collector_id = #{collectorId} and collector_channel_code = #{channelCode} |
| | | and exception_type = 'COLLECTOR_DISCONNECTED' and interval_status = 'OPEN' |
| | | order by interval_id desc limit 1 |
| | | </select> |
| | | <insert id="insertCollectorExceptionInterval" parameterType="TTestCollectorExceptionInterval" useGeneratedKeys="true" keyProperty="intervalId"> |
| | | insert into t_test_collector_exception_interval |
| | | (test_id, battery_relation_id, collector_id, collector_channel_code, exception_type, |
| | | opened_at_utc, missing_from_utc, detail) |
| | | values (#{testId}, #{batteryRelationId}, #{collectorId}, #{collectorChannelCode}, |
| | | #{exceptionType}, #{openedAtUtc}, #{missingFromUtc}, #{detail}) |
| | | </insert> |
| | | <update id="closeCollectorExceptionInterval"> |
| | | update t_test_collector_exception_interval |
| | | set recovered_at_utc = #{recoveredAtUtc}, missing_to_utc = #{missingToUtc}, interval_status = 'CLOSED' |
| | | where interval_id = #{intervalId} and interval_status = 'OPEN' |
| | | </update> |
| | | <select id="selectCollectorExceptionIntervals" parameterType="Long" resultMap="TTestCollectorExceptionIntervalResultMap"> |
| | | select exception_fact.*, collector.collector_code, collector.collector_name, |
| | | mapping.measurement_name |
| | | from t_test_collector_exception_interval exception_fact |
| | | left join t_collector collector on collector.collector_id = exception_fact.collector_id |
| | | left join t_test_collector_channel mapping on mapping.battery_relation_id = exception_fact.battery_relation_id |
| | | and mapping.collector_id = exception_fact.collector_id |
| | | and mapping.channel_code = exception_fact.collector_channel_code |
| | | where exception_fact.test_id = #{testId} |
| | | order by exception_fact.opened_at_utc, exception_fact.interval_id |
| | | </select> |
| | | </mapper> |