| | |
| | | <result property="testTypeName" column="test_type_name" /> |
| | | <result property="testPurpose" column="test_purpose" /> |
| | | <result property="testStatus" column="test_status" /> |
| | | <result property="monitoringStatus" column="monitoring_status" /> |
| | | <result property="receptionStatus" column="reception_status" /> |
| | | <result property="monitorTimeoutMinutes" column="monitor_timeout_minutes" /> |
| | | <result property="startedAtUtc" column="started_at_utc" /> |
| | | <result property="endedAtUtc" column="ended_at_utc" /> |
| | |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="remark" column="remark" /> |
| | | <result property="batteryCount" column="battery_count" /> |
| | | <result property="batteryNo" column="battery_no" /> |
| | | </resultMap> |
| | | |
| | | <resultMap id="TTestBatteryResultMap" type="TTestBattery"> |
| | |
| | | <result property="displayNo" column="display_no" /> |
| | | </resultMap> |
| | | |
| | | <resultMap id="TTestCollectorChannelResultMap" type="TTestCollectorChannel"> |
| | | <id property="mappingId" column="mapping_id" /> |
| | | <result property="testId" column="test_id" /> |
| | | <result property="batteryRelationId" column="battery_relation_id" /> |
| | | <result property="collectorId" column="collector_id" /> |
| | | <result property="measurementCode" column="measurement_code" /> |
| | | <result property="measurementName" column="measurement_name" /> |
| | | <result property="channelCode" column="channel_code" /> |
| | | </resultMap> |
| | | |
| | | <resultMap id="TTestFieldSnapshotResultMap" type="TTestFieldSnapshot"> |
| | | <id property="snapshotId" column="snapshot_id" /> |
| | | <result property="testId" column="test_id" /> |
| | | <result property="fieldDefinitionId" column="field_definition_id" /> |
| | | <result property="fieldName" column="field_name" /> |
| | | <result property="fieldType" column="field_type" /> |
| | | <result property="fieldValue" column="field_value" /> |
| | | </resultMap> |
| | | |
| | | <resultMap id="TTestPlanStepResultMap" type="TTestPlanStep"> |
| | | <id property="planStepId" column="plan_step_id" /> |
| | | <result property="testId" column="test_id" /> |
| | |
| | | select t.test_id, t.test_name, t.creator_id, creator.nick_name creator_name, |
| | | t.principal_id, principal.nick_name principal_name, |
| | | t.test_type_id, ty.test_type_name, t.test_purpose, |
| | | t.test_status, t.monitoring_status, t.monitor_timeout_minutes, |
| | | t.test_status, t.reception_status, t.monitor_timeout_minutes, |
| | | t.started_at_utc, t.ended_at_utc, t.del_flag, |
| | | t.create_by, t.create_time, t.update_by, t.update_time, t.remark, |
| | | (select count(1) from t_test_battery b where b.test_id = t.test_id and b.del_flag = 0) battery_count |
| | | (select count(1) from t_test_battery b where b.test_id = t.test_id and b.del_flag = 0) battery_count, |
| | | (select group_concat(b.battery_no order by b.relation_id separator '、') |
| | | from t_test_battery b where b.test_id = t.test_id and b.del_flag = 0) battery_no |
| | | from t_test t |
| | | left join sys_user creator on creator.user_id = t.creator_id and creator.del_flag = '0' |
| | | left join sys_user principal on principal.user_id = t.principal_id and principal.del_flag = '0' |
| | |
| | | <if test="testTypeId != null">and t.test_type_id = #{testTypeId}</if> |
| | | <if test="batteryNo != null and batteryNo != ''">and exists (select 1 from t_test_battery fb where fb.test_id = t.test_id and fb.battery_no = #{batteryNo} and fb.del_flag = 0)</if> |
| | | <if test="testStatus != null and testStatus != ''">and t.test_status = #{testStatus}</if> |
| | | <if test="monitoringStatus != null and monitoringStatus != ''">and t.monitoring_status = #{monitoringStatus}</if> |
| | | <if test="receptionStatus != null and receptionStatus != ''">and t.reception_status = #{receptionStatus}</if> |
| | | <if test="beginCreateTime != null">and t.create_time >= #{beginCreateTime}</if> |
| | | <if test="endCreateTime != null">and t.create_time <= #{endCreateTime}</if> |
| | | </where> |
| | |
| | | |
| | | <insert id="insertTest" parameterType="TTest" useGeneratedKeys="true" keyProperty="testId"> |
| | | insert into t_test |
| | | (test_name, creator_id, principal_id, test_type_id, test_purpose, test_status, monitoring_status, |
| | | (test_name, creator_id, principal_id, test_type_id, test_purpose, test_status, reception_status, |
| | | monitor_timeout_minutes, del_flag, create_by, create_time, remark) |
| | | values |
| | | (#{testName}, #{creatorId}, #{principalId}, #{testTypeId}, #{testPurpose}, #{testStatus}, #{monitoringStatus}, |
| | | (#{testName}, #{creatorId}, #{principalId}, #{testTypeId}, #{testPurpose}, #{testStatus}, #{receptionStatus}, |
| | | #{monitorTimeoutMinutes}, 0, #{createBy}, #{createTime}, #{remark}) |
| | | </insert> |
| | | |
| | |
| | | set test_name = #{testName}, principal_id = #{principalId}, test_type_id = #{testTypeId}, |
| | | test_purpose = #{testPurpose}, monitor_timeout_minutes = #{monitorTimeoutMinutes}, |
| | | remark = #{remark}, update_by = #{updateBy}, update_time = #{updateTime} |
| | | where test_id = #{testId} and monitoring_status = 'NOT_MONITORED' and del_flag = 0 |
| | | where test_id = #{testId} and reception_status = 'NOT_STARTED' and del_flag = 0 |
| | | </update> |
| | | |
| | | <update id="deleteTestById"> |
| | | update t_test set del_flag = test_id, update_by = #{updateBy}, update_time = sysdate() |
| | | where test_id = #{testId} and monitoring_status = 'NOT_MONITORED' and del_flag = 0 |
| | | where test_id = #{testId} and reception_status = 'NOT_STARTED' and del_flag = 0 |
| | | </update> |
| | | |
| | | <delete id="deleteTestBindingsByTestId">delete from t_test_channel_binding where test_id = #{testId}</delete> |
| | | <delete id="deleteTestCollectorChannelsByTestId">delete from t_test_collector_channel where test_id = #{testId}</delete> |
| | | <delete id="deleteTestFieldSnapshotsByTestId">delete from t_test_field_snapshot where test_id = #{testId}</delete> |
| | | <delete id="deleteTestPlanStepsByTestId">delete from t_test_plan_step where test_id = #{testId}</delete> |
| | | <update id="deleteTestFieldsByTestId"> |
| | | update t_test_battery_field f join t_test_battery b on b.relation_id = f.relation_id |
| | |
| | | <insert id="insertTestChannelBinding" parameterType="TTestChannelBinding" useGeneratedKeys="true" keyProperty="bindingId"> |
| | | insert into t_test_channel_binding(test_id, battery_relation_id, channel_id, expected_barcode, claim_status) |
| | | values(#{testId}, #{batteryRelationId}, #{channelId}, #{expectedBarcode}, #{claimStatus}) |
| | | </insert> |
| | | <insert id="insertTestCollectorChannel" parameterType="TTestCollectorChannel" useGeneratedKeys="true" keyProperty="mappingId"> |
| | | insert into t_test_collector_channel |
| | | (test_id, battery_relation_id, collector_id, measurement_code, measurement_name, channel_code) |
| | | values(#{testId}, #{batteryRelationId}, #{collectorId}, #{measurementCode}, #{measurementName}, #{channelCode}) |
| | | </insert> |
| | | <insert id="insertTestFieldSnapshot" parameterType="TTestFieldSnapshot" useGeneratedKeys="true" keyProperty="snapshotId"> |
| | | insert into t_test_field_snapshot |
| | | (test_id, field_definition_id, field_name, field_type, field_value) |
| | | values(#{testId}, #{fieldDefinitionId}, #{fieldName}, #{fieldType}, #{fieldValue}) |
| | | </insert> |
| | | <insert id="insertTestThreshold" parameterType="TTestWarningThreshold" useGeneratedKeys="true" keyProperty="thresholdId"> |
| | | insert into t_test_warning_threshold(test_id, metric_code, min_value, max_value, unit, severity, del_flag) |
| | |
| | | join t_detection_channel channel_fact on channel_fact.channel_id = binding.channel_id |
| | | join t_detection_cabinet cabinet on cabinet.cabinet_id = channel_fact.cabinet_id |
| | | where binding.test_id = #{testId} order by binding.binding_id |
| | | </select> |
| | | <select id="selectTestCollectorChannels" parameterType="Long" resultMap="TTestCollectorChannelResultMap"> |
| | | select mapping_id, test_id, battery_relation_id, collector_id, |
| | | measurement_code, measurement_name, channel_code |
| | | from t_test_collector_channel where test_id = #{testId} |
| | | order by battery_relation_id, mapping_id |
| | | </select> |
| | | <select id="selectTestFieldSnapshots" parameterType="Long" resultMap="TTestFieldSnapshotResultMap"> |
| | | select snapshot_id, test_id, field_definition_id, field_name, field_type, field_value |
| | | from t_test_field_snapshot where test_id = #{testId} order by snapshot_id |
| | | </select> |
| | | <select id="selectTestThresholds" parameterType="Long" resultMap="TTestThresholdResultMap"> |
| | | select threshold_id, test_id, metric_code, min_value, max_value, unit, severity, del_flag |
| | |
| | | <select id="countCollectorEnabled" resultType="int"> |
| | | select count(1) from t_collector where collector_id = #{collectorId} and status = '0' and del_flag = 0 |
| | | </select> |
| | | <select id="selectCollectorChannelCount" resultType="int"> |
| | | select channel_count from t_collector where collector_id = #{collectorId} and status = '0' and del_flag = 0 |
| | | </select> |
| | | |
| | | <select id="selectEnabledUserOptions" resultType="com.ruoyi.system.domain.vo.TestUserOptionVo"> |
| | | select user_id userId, user_name userName, nick_name nickName |
| | |
| | | order by cabinet.cabinet_name, channel_fact.chlid, channel_fact.channel_id |
| | | </select> |
| | | <select id="selectEnabledCollectorOptions" resultType="com.ruoyi.system.domain.vo.TestCollectorOptionVo"> |
| | | select collector_id collectorId, collector_code collectorCode, collector_name collectorName |
| | | select collector_id collectorId, collector_code collectorCode, collector_name collectorName, |
| | | channel_count channelCount |
| | | from t_collector where status = '0' and del_flag = 0 order by collector_name, collector_id |
| | | </select> |
| | | |