潘志宝
9 天以前 6b13839488edcd06046e26a41fe897358176689c
提交 | 用户 | 时间
a6de49 1 <?xml version="1.0" encoding="UTF-8"?>
H 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
4 <mapper namespace="com.iailab.module.data.point.dao.DaPointDao">
5
6     <select id="getPageList" resultType="com.iailab.module.data.point.dto.DaPointDTO">
7       select
8       t1.id,
9       t1.point_no,
10       t1.point_name,
11       t1.point_type ,
12       t1.data_type,
13       t1.unit,
14       t1.unittransfactor,
15       t1.default_value,
16       t1.max_value,
17       t1.min_value,
18       t1.minfreqid,
19       t1.remark,
20       t1.is_enable,
21       t1.creator,
22       t1.create_time,
23       t1.updater,
24       t1.update_time,
25       t2.source_type,
26       t3.source_name,
6d7e4d 27       t2.tag_no,
L 28       t2.dimension,
6b1383 29       t2.value_type,
30       t6.collect_value,
31       t6.collect_quality,
32       t6.collect_time
a6de49 33       from t_da_point t1
H 34       left join t_da_measure_point t2 on t2.point_id = t1.id
6b1383 35       left join t_da_point_collect_status t6 on t6.point_no = t1.point_no
a6de49 36       left join (
H 37         select id source_id,server_name source_name
38         from t_channel_opcua_device
39         union
40         select id source_id, name source_name
41         from t_channel_modbus_device
42         union
43         select id source_id, code source_name
44         from t_http_api
45         union
46         select id source_id, instance_name source_name
47         from t_channel_kio_device
48       ) t3 on t3.source_id = t2.source_id
49         <where>
50             <if test="params.pointNo != null and params.pointNo != ''">
51                 and t1.point_no like concat('%', #{params.pointNo}, '%')
52             </if>
53             <if test="params.pointName != null and params.pointName != ''">
54                 and t1.point_name like concat('%', #{params.pointName}, '%')
55             </if>
56             <if test="params.pointType != null and params.pointType != ''">
57                 and t1.point_type = #{params.pointType}
58             </if>
59             <if test="params.dataType != null and params.dataType != ''">
60                 and t1.data_type = #{params.dataType}
61             </if>
62             <if test="params.sourceName != null and params.sourceName != ''">
63                 and t3.source_name like concat('%', #{params.sourceName}, '%')
64             </if>
65             <if test="params.tagNo != null and params.tagNo != ''">
66                 and t2.tag_no like concat('%', #{params.tagNo}, '%')
67             </if>
68             <if test="params.isEnable != null ">
69                 and t1.is_enable = #{params.isEnable}
70             </if>
71         </where>
a4891a 72         order by t1.create_time desc, t1.point_no desc
a6de49 73     </select>
H 74
14cb32 75     <select id="getList" resultType="com.iailab.module.data.point.dto.DaPointDTO">
76         select
77         t1.id,
78         t1.point_no,
79         t1.point_name,
80         t1.point_type ,
81         t1.data_type,
82         t1.unit,
83         t1.unittransfactor,
84         t1.default_value,
85         t1.max_value,
86         t1.min_value,
87         t1.minfreqid,
88         t1.remark,
89         t1.is_enable,
90         t1.creator,
91         t1.create_time,
92         t1.updater,
93         t1.update_time,
94         t2.source_type,
95         t3.source_name,
96         t2.tag_no,
97         t2.dimension,
98         t2.value_type
99         from t_da_point t1
100         left join t_da_measure_point t2 on t2.point_id = t1.id
101         left join (
102         select id source_id,server_name source_name
103         from t_channel_opcua_device
104         union
105         select id source_id, name source_name
106         from t_channel_modbus_device
107         union
108         select id source_id, code source_name
109         from t_http_api
110         union
111         select id source_id, instance_name source_name
112         from t_channel_kio_device
113         ) t3 on t3.source_id = t2.source_id
114         <where>
115             <if test="pointNo != null and pointNo != ''">
116                 and t1.point_no like concat('%', #{pointNo}, '%')
117             </if>
118             <if test="pointName != null and pointName != ''">
119                 and t1.point_name like concat('%', #{pointName}, '%')
120             </if>
121             <if test="pointType != null and pointType != ''">
122                 and t1.point_type = #{pointType}
123             </if>
124             <if test="dataType != null and dataType != ''">
125                 and t1.data_type = #{dataType}
126             </if>
127             <if test="sourceName != null and sourceName != ''">
128                 and t3.source_name like concat('%', #{sourceName}, '%')
129             </if>
130             <if test="tagNo != null and tagNo != ''">
131                 and t2.tag_no like concat('%', #{tagNo}, '%')
132             </if>
133             <if test="isEnable != null ">
134                 and t1.is_enable = #{isEnable}
135             </if>
136         </where>
a4891a 137         order by t1.create_time desc, t1.point_no desc
14cb32 138     </select>
139
a6de49 140     <select id="getConstantPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
H 141         SELECT
142         t1.point_no,
143         t1.point_name,
144         t1.default_value,
145         t1.point_type,
146         t1.store_type,
eef888 147         t1.data_type,
148         t1.minfreqid
a6de49 149         FROM t_da_point t1
H 150         <where>
151             t1.point_type =  #{pointType}
152             <if test="isEnable != null">
153                 AND t1.is_enable = #{isEnable}
154             </if>
155             <if test="minfreqid != null and minfreqid != ''">
156                 AND t1.minfreqid = #{minfreqid}
157             </if>
158             <if test="pointNos != null">
159                 AND t1.point_no in
160                 <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
161                     #{item}
162                 </foreach>
163             </if>
164         </where>
165     </select>
166
167     <select id="getMeasurePoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
168         SELECT
169         t1.point_no,
170         t1.point_name,
171         t1.point_type,
172         t1.data_type,
173         t1.store_type,
174         t1.default_value,
175         t1.unittransfactor,
176         t1.max_value,
177         t1.min_value,
eef888 178         t1.minfreqid,
a6de49 179         t2.source_type,
H 180         t2.source_id,
181         t3.source_name,
52487d 182         t2.tag_no,
L 183         t2.dimension,
184         t2.value_type
a6de49 185         FROM t_da_point t1
H 186         LEFT JOIN t_da_measure_point t2 ON t2.point_id = t1.id
187         left join (
188             select id source_id,server_name source_name
189             from t_channel_opcua_device
190             union
191             select id source_id, name source_name
192             from t_channel_modbus_device
193             union
194             select id source_id, instance_name source_name
195             from t_channel_kio_device
196             union
197             select id source_id, code source_name
198             from t_http_api
199         ) t3 on t3.source_id = t2.source_id
200         <where>
201             t1.point_type =  #{pointType}
202             <if test="isEnable != null">
203                 AND t1.is_enable = #{isEnable}
204             </if>
205             <if test="minfreqid != null and minfreqid != ''">
206                 AND t1.minfreqid = #{minfreqid}
207             </if>
208             <if test="pointNo != null and pointNo != ''">
209                 AND t1.point_no = #{pointNo}
210             </if>
211             <if test="pointNos != null">
212                 AND t1.point_no in
213                 <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
214                     #{item}
215                 </foreach>
216             </if>
217         </where>
218     </select>
14cb32 219
a6de49 220     <select id="getMathPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
H 221         SELECT
222         t1.point_no,
223         t1.point_name,
224         t1.default_value,
225         t1.point_type,
226         t1.data_type,
227         t1.store_type,
eef888 228         t1.minfreqid,
a6de49 229         t2.expression
H 230         FROM t_da_point t1
231         LEFT JOIN t_da_math_point t2 ON t2.point_id = t1.id
232         <where>
233             t1.point_type =  #{pointType}
234             <if test="isEnable != null">
235                 AND t1.is_enable = #{isEnable}
236             </if>
237             <if test="minfreqid != null and minfreqid != ''">
238                 AND t1.minfreqid = #{minfreqid}
239             </if>
240         </where>
241     </select>
242
56dba6 243     <select id="getCumulatePoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
244         SELECT
245         t1.point_no,
246         t1.point_name,
247         t1.default_value,
248         t1.point_type,
249         t1.data_type,
250         t1.store_type,
251         t1.minfreqid,
252         t2.moment_point,
253         t2.length,
254         t2.divisor
255         FROM t_da_point t1
256         LEFT JOIN t_da_cumulate_point t2 ON t2.point_id = t1.id
257         <where>
258             t1.point_type =  #{pointType}
259             <if test="isEnable != null">
260                 AND t1.is_enable = #{isEnable}
261             </if>
262             <if test="minfreqid != null and minfreqid != ''">
263                 AND t1.minfreqid = #{minfreqid}
264             </if>
265         </where>
266     </select>
267
a6de49 268 </mapper>