yangkang
2023-09-12 a6d8cfbf89fae62167c99dab7ffddaeb6f2b7de5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.jeecg.modules.eam.mapper.PredictiveWorkPlanParameterMapper">
 
    <select id="listPredictiveWorkPlanParameter"  parameterType="Map" resultType="org.jeecg.modules.eam.entity.PredictiveWorkPlanParameter">
        SELECT
        t1.id parameterId,
        t1.chinese_name parameterName,
        t1.english_name parameterCode,
        t2.saveTableName
        FROM
        mdc_drive_type_param_config t1
        LEFT JOIN Equipment t2 ON t2.controlSystem = t1.control_system_type
        LEFT JOIN mom_eam_equipment t3 ON t3.num = t2.EquipmentID
        WHERE t3.id = #{params.equipmentId}
            <if test="params.parameterCode != null and params.parameterCode != ''">
                and t1.english_name = concat('%',#{params.parameterCode},'%')
            </if>
            <if test="params.parameterName != null and params.parameterName != ''">
                and t1.chinese_name = concat('%',#{params.parameterName},'%')
            </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="pagePredictiveWorkPlanParameter"  parameterType="Map" resultType="Map">
        SELECT
        t1.*,
        t1.parameter_code parameterCode,
        t1.parameter_name parameterName,
        t1.upper_limit_value upperLimitValue,
        t1.lower_limit_value lowerLimitValue,
        t2.name unitName,
        t3.item_text conditionalRelationName
        FROM
        mom_eam_predictive_work_plan_parameter t1
        LEFT JOIN mom_base_unit t2 ON t2.id = t1.parameter_unit
        LEFT JOIN ( SELECT * FROM v_sys_dict WHERE dict_code = 'conditional_relation' ) t3 ON t3.item_value = t1.parameter_condition
        WHERE
        t1.del_flag = 0
        <if test="params.planId != null and params.planId != ''">
            and t1.work_plan_id = #{params.planId}
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="listParameter"  parameterType="Map" resultType="org.jeecg.modules.eam.entity.PredictiveWorkPlanParameter">
        SELECT
            t1.work_plan_id workPlanId,
            t1.parameter_id parameterId,
            t1.parameter_code parameterCode,
            t1.parameter_name parameterName,
            t1.upper_limit_value upperLimitValue,
            t1.lower_limit_value lowerLimitValue,
            t1.parameter_condition parameterCondition,
            t1.save_table_name saveTableName
        FROM
            mom_eam_predictive_work_plan_parameter t1
        WHERE t1.del_flag = 0
        <if test="params.planId != null and params.planId != ''">
            and t1.work_plan_id = #{params.planId}
        </if>
        ORDER BY t1.create_time desc
    </select>
 
    <select id="findParameterInfo"  parameterType="Map" resultType="org.jeecg.modules.eam.model.ParameterVo">
        SELECT TOP 1
            t1.CollectTime collectTime,
            t1.${parameterCode} actualValue
        FROM
            [${saveTableName}] t1
        WHERE
            t1.${parameterCode} <![CDATA[ < ]]>  #{lowerLimitValue}
            OR t1.${parameterCode} > #{upperLimitValue}
        ORDER BY
            t1.CollectTime DESC
    </select>
 
</mapper>