潘志宝
2024-12-12 bd90850664bfe4b43df094321e811f3bb398f97f
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<?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.MmPredictItemDao">
 
    <resultMap id="ItemVO" type="com.iailab.module.model.mdk.vo.ItemVO">
        <result property="id" column="ID"/>
        <result property="itemNo" column="ITEMNO"/>
        <result property="itemName" column="ITEMNAME"/>
        <result property="itemType" column="ITEMTYPENAME"/>
        <result property="predictLength" column="PREDICTLENGTH"/>
        <result property="granularity" column="GRANULARITY"/>
        <result property="status" column="STATUS"/>
        <result property="isFuse" column="ISFUSE"/>
        <result property="predictPhase" column="PREDICTPHASE"/>
        <result property="workChecked" column="WORKCHECKED"/>
        <result property="lastTime" column="last_time"/>
    </resultMap>
 
    <resultMap id="MergeItemVO" type="com.iailab.module.model.mdk.vo.MergeItemVO">
        <result property="id" column="ID"/>
        <result property="itemId" column="ITEMID"/>
        <result property="expression" column="EXPRESSION"/>
    </resultMap>
 
    <select id="getPageList" resultType="com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO"
            parameterType="map">
        SELECT
        TMPI.ID,
        TMPI.ITEMNO,
        TMPI.ITEMNAME,
        TMPI.ITEMTYPEID,
        TMIT.ITEMTYPENAME,
        TMPI.PREDICTLENGTH,
        TMPI.GRANULARITY,
        TMPI.ISFUSE,
        TMPI.WORKCHECKED,
        TDMI.MODULEID,
        TDMI.ITEMORDER,
        TMPI.STATUS,
        TDMI.CATEGORYID,
        TMIS.last_time,
        TMIS.status run_status,
        TMIS.duration,
        TDMM.modulename
        FROM T_MM_PREDICT_ITEM TMPI
        LEFT JOIN T_MM_ITEM_TYPE TMIT ON TMIT.ID = TMPI.ITEMTYPEID
        LEFT JOIN T_DM_MODULE_ITEM TDMI ON TDMI.ITEMID = TMPI.ID
        LEFT JOIN t_mm_item_status TMIS ON TMIS.item_id = TMPI.ID
        LEFT JOIN T_DM_MODULE TDMM ON TDMM.id = TDMI.moduleid
        <where>
            <if test="params.itemno != null and params.itemno != ''">
                AND TMPI.ITEMNO LIKE CONCAT('%', #{params.itemno},'%')
            </if>
            <if test="params.itemname != null and params.itemname != ''">
                AND TMPI.ITEMNAME LIKE CONCAT('%', #{params.itemname},'%')
            </if>
            <if test="params.itemtypeid != null and params.itemtypeid != ''">
                AND TMPI.ITEMTYPEID = #{params.itemtypeid}
            </if>
            <if test="params.itemtypename != null and params.itemtypename != ''">
                AND TMIT.ITEMTYPENAME = #{params.itemtypename}
            </if>
            <if test="params.status != null and params.status != ''">
                AND TMPI.STATUS = #{params.status}
            </if>
            <if test="params.modulename != null and params.modulename != ''">
                AND TDMM.modulename LIKE CONCAT('%', #{params.modulename},'%')
            </if>
        </where>
        ORDER BY TMPI.CREATE_TIME DESC
    </select>
 
    <resultMap id="MmPredictItemRespVO" type="com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO">
        <result property="id" column="ID"/>
        <result property="itemno" column="ITEMNO"/>
        <result property="itemname" column="ITEMNAME"/>
        <result property="itemtypeid" column="ITEMTYPEID"/>
        <result property="itemtypename" column="ITEMTYPENAME"/>
        <result property="predictlength" column="predictlength"/>
        <result property="granularity" column="GRANULARITY"/>
        <result property="isfuse" column="ISFUSE"/>
        <result property="workchecked" column="WORKCHECKED"/>
        <result property="moduleid" column="MODULEID"/>
        <result property="itemorder" column="ITEMORDER"/>
        <result property="status" column="STATUS"/>
        <result property="categoryid" column="CATEGORYID"/>
        <collection property="outPuts" ofType="com.iailab.module.model.mcs.pre.vo.MmItemOutputRespVO">
            <result property="id" column="out_put_id"/>
            <result property="outputorder" column="out_put_order"/>
            <result property="resultName" column="result_name"/>
        </collection>
    </resultMap>
 
    <select id="queryList" resultMap="MmPredictItemRespVO" parameterType="map">
        SELECT
        TMPI.ID,
        TMPI.ITEMNO,
        TMPI.ITEMNAME,
        TMPI.ITEMTYPEID,
        TMIT.ITEMTYPENAME,
        TMPI.predictlength,
        TMPI.GRANULARITY,
        TMPI.ISFUSE,
        TMPI.WORKCHECKED,
        TDMI.MODULEID,
        TDMI.ITEMORDER,
        TMPI.STATUS,
        TDMI.CATEGORYID,
        TMIO.id out_put_id,
        TMIO.outputorder out_put_order,
        TMIO.result_name
        FROM T_MM_PREDICT_ITEM TMPI
        LEFT JOIN T_MM_ITEM_TYPE TMIT ON TMIT.ID = TMPI.ITEMTYPEID
        LEFT JOIN T_DM_MODULE_ITEM TDMI ON TDMI.ITEMID = TMPI.ID
        LEFT JOIN t_mm_item_output TMIO ON TMIO.itemid = TMPI.ID
        WHERE 1 = 1
        <if test="itemno != null and itemno != ''">
            AND TMPI.ITEMNO LIKE CONCAT('%', #{itemno},'%')
        </if>
        <if test="itemname != null and itemname != ''">
            AND TMPI.ITEMNAME LIKE CONCAT('%', #{itemname},'%')
        </if>
        <if test="itemtypeid != null and itemtypeid != ''">
            AND TMPI.ITEMTYPEID = #{itemtypeid}
        </if>
        <if test="itemtypename != null and itemtypename != ''">
            AND TMIT.ITEMTYPENAME = #{itemtypename}
        </if>
        <if test="status != null and status != ''">
            AND TMPI.STATUS = #{status}
        </if>
        ORDER BY TMPI.CREATE_TIME DESC,TMIO.outputorder
    </select>
 
    <select id="getByModuleId" parameterType="map" resultMap="ItemVO">
        SELECT t1.id,
               t1.itemno,
               t1.itemname,
               t3.itemtypename,
               t1.predictlength,
               t1.granularity,
               t1.status,
               t1.isfuse,
               t1.workchecked,
               t1.unittransfactor
        FROM t_mm_predict_item t1,
             t_dm_module_item t2,
             t_mm_item_type t3
        WHERE t1.id = t2.itemid
          AND t1.itemtypeid = t3.id
          AND t2.moduleid = #{MODULEID}
          AND t2.status = 1
          AND t1.status = 1
        ORDER BY t2.itemorder
    </select>
 
    <select id="getItem" parameterType="map" resultMap="ItemVO">
        SELECT
        t1.id,
        t1.itemno ,
        t1.itemname ,
        t1.predictlength ,
        t2.itemtypename,
        t1.granularity,
        t1.status,
        t1.isfuse,
        t1.predictphase,
        t1.workchecked,
        t3.last_time
        FROM
        t_mm_predict_item t1
        LEFT JOIN t_mm_item_type t2 on t2.id = t1.itemtypeid
        LEFT JOIN t_mm_item_status t3 on t3.item_id = t1.id
        <where>
            <if test="ITEMID != null and ITEMID != ''">
                AND t1.id=#{ITEMID}
            </if>
            <if test="ITEMNO != null and ITEMNO != ''">
                t1.itemno=#{ITEMNO}
            </if>
        </where>
    </select>
    <select id="getMergeItemByItemId" parameterType="map" resultMap="MergeItemVO">
        SELECT t1.id,
               t1.itemid,
               t1.expression
        FROM t_mm_predict_merge_item t1
        WHERE t1.itemid = #{ITEMID}
    </select>
 
 
</mapper>