yeg
2026-08-29 8ba28ba5fbee0582f742f6eb1e824544869abc05
ruoyi-system/src/main/resources/mapper/system/TTestMapper.xml
@@ -75,15 +75,6 @@
        <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" />
@@ -124,9 +115,7 @@
               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 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
               (select count(1) from t_test_battery b where b.test_id = t.test_id and b.del_flag = 0) battery_count
        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'
@@ -147,6 +136,14 @@
            <if test="endCreateTime != null">and t.create_time &lt;= #{endCreateTime}</if>
        </where>
        order by t.create_time desc, t.test_id desc
    </select>
    <select id="selectBatteryNosByTestIds" resultMap="TTestBatteryResultMap">
        select test_id, battery_no
        from t_test_battery
        where del_flag = 0 and test_id in
        <foreach collection="testIds" item="testId" open="(" separator="," close=")">#{testId}</foreach>
        order by test_id, relation_id
    </select>
    <select id="selectTestById" parameterType="Long" resultMap="TTestResultMap">
@@ -189,7 +186,6 @@
    <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
@@ -222,11 +218,6 @@
        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)
@@ -268,10 +259,6 @@
               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