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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?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="com.iailab.module.model.mcs.pre.dao.MmPredictInfluenceFactorDao">
    <resultMap id="influenceFactor" type="com.iailab.module.model.mcs.pre.vo.MmPredictInfluenceFactorConfigVO">
        <id property="id" column="id"/>
        <result property="outputId" column="output_id"/>
        <result property="outputName" column="output_name"/>
        <result property="pattern" column="pattern"/>
        <result property="isEnable" column="is_enable"/>
        <result property="createTime" column="create_time"/>
        <collection property="influenceFactors" ofType="com.iailab.module.model.mcs.pre.vo.MmPredictInfluenceFactorVO">
            <id property="id" column="factors_id"/>
            <result property="factorOutputId" column="factor_output_id"/>
            <result property="factorOutputName" column="factor_output_name"/>
            <result property="deviationValue" column="deviation_value"/>
            </collection>
    </resultMap>
    <insert id="insertInfluenceFactor" parameterType="com.iailab.module.model.mcs.pre.vo.MmPredictInfluenceFactorVO">
        INSERT INTO
        t_mm_predict_influence_factor
        (id,config_id,factor_output_id,deviation_value)
        VALUES
        <foreach collection="list" item="item" separator=",">
            (#{item.id},#{item.configId},#{item.factorOutputId},#{item.deviationValue})
        </foreach>
    </insert>
 
    <select id="getPage" resultMap="influenceFactor">
        SELECT
        t1.id,
        t1.output_id,
        t3.result_name output_name,
        t1.pattern,
        t1.is_enable,
        t1.create_time,
        t2.id factors_id,
        t2.factor_output_id,
        t4.result_name factor_output_name,
        t2.deviation_value
        FROM
        t_mm_predict_influence_factor_config t1
        LEFT JOIN t_mm_predict_influence_factor t2 ON t1.id = t2.config_id
        LEFT JOIN t_mm_item_output t3 ON t1.output_id = t3.id
        LEFT JOIN t_mm_item_output t4 ON t2.factor_output_id = t4.id
        <where>
            <if test="params.outputName != null and params.outputName != ''">
                and t3.result_name like CONCAT('%', #{params.outputName},'%')
            </if>
            <if test="params.pattern != null and params.pattern != ''">
                and t1.pattern = #{params.pattern}
            </if>
        </where>
        order by t1.create_time desc
    </select>
    <select id="getInfo" resultMap="influenceFactor" parameterType="java.lang.String">
        SELECT
            t1.id,
            t1.output_id,
            t3.result_name output_name,
            t1.pattern,
            t1.is_enable,
            t1.create_time,
            t2.id factors_id,
            t2.factor_output_id,
            t2.deviation_value
        FROM
            t_mm_predict_influence_factor_config t1
            LEFT JOIN t_mm_predict_influence_factor t2 ON t1.id = t2.config_id
            LEFT JOIN t_mm_item_output t3 on t1.output_id = t3.id
        where t1.id = #{id}
    </select>
    <select id="selectList" resultType="com.iailab.module.model.mcs.pre.vo.MmPredictInfluenceFactorHandleVO" parameterType="map">
        SELECT
        t2.id,
        t2.factor_output_id,
        t2.deviation_value,
        t1.pattern,
        t3.pointid,
        t4.predictlength,
        t4.granularity
        FROM
        t_mm_predict_influence_factor_config t1
        LEFT JOIN t_mm_predict_influence_factor t2 ON t1.id = t2.config_id
        LEFT JOIN t_mm_item_output t3 ON t2.factor_output_id = t3.id
        LEFT JOIN t_mm_predict_item t4 ON t3.itemid = t4.id
        <where>
            <if test="params.isEnable != null and params.isEnable != ''">
                and t1.is_enable = #{params.isEnable}
            </if>
            <if test="params.pattern != null and params.pattern != ''">
                and t1.pattern = #{params.pattern}
            </if>
        </where>
        order by t1.create_time desc
    </select>
</mapper>