| | |
| | | <result property="intervalStatus" column="interval_status" /> |
| | | <result property="detail" column="detail" /> |
| | | </resultMap> |
| | | <resultMap id="TTestReceptionIntervalResultMap" type="TTestReceptionInterval"> |
| | | <id property="intervalId" column="interval_id" /> |
| | | <result property="testId" column="test_id" /> |
| | | <result property="bindingId" column="binding_id" /> |
| | | <result property="sourceType" column="source_type" /> |
| | | <result property="sourceId" column="source_id" /> |
| | | <result property="sourceChannelCode" column="source_channel_code" /> |
| | | <result property="actionAtUtc" column="action_at_utc" /> |
| | | <result property="startBoundaryAtUtc" column="start_boundary_at_utc" /> |
| | | <result property="endBoundaryAtUtc" column="end_boundary_at_utc" /> |
| | | <result property="boundaryNote" column="boundary_note" /> |
| | | <result property="intervalStatus" column="interval_status" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectTestBase"> |
| | | select t.test_id, t.test_name, t.creator_id, creator.nick_name creator_name, |
| | |
| | | select threshold_id, test_id, metric_code, min_value, max_value, unit, severity, del_flag |
| | | from t_test_warning_threshold where test_id = #{testId} and del_flag = 0 order by threshold_id |
| | | </select> |
| | | <select id="selectTestReceptionIntervals" parameterType="Long" resultMap="TTestReceptionIntervalResultMap"> |
| | | select interval_id, test_id, binding_id, source_type, source_id, source_channel_code, |
| | | action_at_utc, start_boundary_at_utc, end_boundary_at_utc, boundary_note, interval_status |
| | | from t_test_reception_interval |
| | | where test_id = #{testId} |
| | | order by source_type, source_id, source_channel_code, start_boundary_at_utc, interval_id |
| | | </select> |
| | | <select id="selectTestResults" parameterType="TTestResult" resultMap="TTestResultResultMap"> |
| | | select result.*, battery.test_id from t_test_result result |
| | | join t_test_battery battery on battery.relation_id = result.relation_id |
| | |
| | | insert into t_collector_channel_lease(collector_id, channel_code, test_id, binding_id, acquired_by, acquired_at_utc) |
| | | values(#{collectorId}, #{channelCode}, #{testId}, #{bindingId}, #{acquiredBy}, #{acquiredAtUtc}) |
| | | </insert> |
| | | <insert id="insertReceptionInterval"> |
| | | insert into t_test_reception_interval |
| | | (test_id, binding_id, source_type, source_id, source_channel_code, |
| | | action_at_utc, start_boundary_at_utc, boundary_note, interval_status) |
| | | values(#{testId}, #{bindingId}, #{sourceType}, #{sourceId}, #{sourceChannelCode}, |
| | | #{actionAtUtc}, #{actionAtUtc}, #{boundaryNote}, 'OPEN') |
| | | </insert> |
| | | <update id="closeOpenReceptionIntervals"> |
| | | update t_test_reception_interval |
| | | set end_boundary_at_utc = #{endBoundaryAtUtc}, |
| | | boundary_note = #{boundaryNote}, interval_status = 'CLOSED' |
| | | where test_id = #{testId} and interval_status = 'OPEN' |
| | | </update> |
| | | <delete id="deleteChannelLeasesByTestId"> |
| | | delete from t_channel_lease where test_id = #{testId} |
| | | </delete> |