潘志宝
2025-02-28 dbd8a0de4b94f846a6beeccfaca3ed5cc08b0b9e
提交 | 用户 | 时间
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>
bbe7ac 71             <if test="params.collectQuality != null and params.collectQuality != ''">
72                 and t6.collect_quality = #{params.collectQuality}
73             </if>
859884 74             <if test="params.pointNos != null">
75                 AND t1.point_no in
d902db 76                 <foreach collection="params.pointNos" item="item" index="item" open="(" close=")" separator=",">
859884 77                     #{item}
78                 </foreach>
79             </if>
a6de49 80         </where>
a4891a 81         order by t1.create_time desc, t1.point_no desc
a6de49 82     </select>
H 83
14cb32 84     <select id="getList" resultType="com.iailab.module.data.point.dto.DaPointDTO">
85         select
86         t1.id,
87         t1.point_no,
88         t1.point_name,
89         t1.point_type ,
90         t1.data_type,
91         t1.unit,
92         t1.unittransfactor,
93         t1.default_value,
94         t1.max_value,
95         t1.min_value,
96         t1.minfreqid,
97         t1.remark,
98         t1.is_enable,
99         t1.creator,
100         t1.create_time,
101         t1.updater,
102         t1.update_time,
103         t2.source_type,
104         t3.source_name,
105         t2.tag_no,
106         t2.dimension,
df99e4 107         t2.value_type,
108         t6.collect_value,
109         t6.collect_quality,
110         t6.collect_time
14cb32 111         from t_da_point t1
112         left join t_da_measure_point t2 on t2.point_id = t1.id
df99e4 113         left join t_da_point_collect_status t6 on t6.point_no = t1.point_no
14cb32 114         left join (
115         select id source_id,server_name source_name
116         from t_channel_opcua_device
117         union
118         select id source_id, name source_name
119         from t_channel_modbus_device
120         union
121         select id source_id, code source_name
122         from t_http_api
123         union
124         select id source_id, instance_name source_name
125         from t_channel_kio_device
126         ) t3 on t3.source_id = t2.source_id
127         <where>
128             <if test="pointNo != null and pointNo != ''">
129                 and t1.point_no like concat('%', #{pointNo}, '%')
130             </if>
131             <if test="pointName != null and pointName != ''">
132                 and t1.point_name like concat('%', #{pointName}, '%')
133             </if>
134             <if test="pointType != null and pointType != ''">
135                 and t1.point_type = #{pointType}
136             </if>
137             <if test="dataType != null and dataType != ''">
138                 and t1.data_type = #{dataType}
139             </if>
140             <if test="sourceName != null and sourceName != ''">
141                 and t3.source_name like concat('%', #{sourceName}, '%')
142             </if>
143             <if test="tagNo != null and tagNo != ''">
144                 and t2.tag_no like concat('%', #{tagNo}, '%')
145             </if>
146             <if test="isEnable != null ">
147                 and t1.is_enable = #{isEnable}
148             </if>
df99e4 149             <if test="collectQuality != null and collectQuality != ''">
150                 and t6.collect_quality = #{collectQuality}
151             </if>
14cb32 152         </where>
a4891a 153         order by t1.create_time desc, t1.point_no desc
14cb32 154     </select>
155
a6de49 156     <select id="getConstantPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
H 157         SELECT
158         t1.point_no,
159         t1.point_name,
160         t1.default_value,
161         t1.point_type,
162         t1.store_type,
eef888 163         t1.data_type,
164         t1.minfreqid
a6de49 165         FROM t_da_point t1
H 166         <where>
167             t1.point_type =  #{pointType}
168             <if test="isEnable != null">
169                 AND t1.is_enable = #{isEnable}
170             </if>
171             <if test="minfreqid != null and minfreqid != ''">
172                 AND t1.minfreqid = #{minfreqid}
173             </if>
174             <if test="pointNos != null">
175                 AND t1.point_no in
176                 <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
177                     #{item}
178                 </foreach>
179             </if>
180         </where>
181     </select>
182
183     <select id="getMeasurePoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
184         SELECT
185         t1.point_no,
186         t1.point_name,
187         t1.point_type,
188         t1.data_type,
189         t1.store_type,
190         t1.default_value,
191         t1.unittransfactor,
192         t1.max_value,
193         t1.min_value,
eef888 194         t1.minfreqid,
a6de49 195         t2.source_type,
H 196         t2.source_id,
197         t3.source_name,
52487d 198         t2.tag_no,
L 199         t2.dimension,
200         t2.value_type
a6de49 201         FROM t_da_point t1
H 202         LEFT JOIN t_da_measure_point t2 ON t2.point_id = t1.id
203         left join (
204             select id source_id,server_name source_name
205             from t_channel_opcua_device
206             union
207             select id source_id, name source_name
208             from t_channel_modbus_device
209             union
210             select id source_id, instance_name source_name
211             from t_channel_kio_device
212             union
213             select id source_id, code source_name
214             from t_http_api
215         ) t3 on t3.source_id = t2.source_id
216         <where>
217             t1.point_type =  #{pointType}
218             <if test="isEnable != null">
219                 AND t1.is_enable = #{isEnable}
220             </if>
221             <if test="minfreqid != null and minfreqid != ''">
222                 AND t1.minfreqid = #{minfreqid}
223             </if>
224             <if test="pointNo != null and pointNo != ''">
225                 AND t1.point_no = #{pointNo}
226             </if>
227             <if test="pointNos != null">
228                 AND t1.point_no in
229                 <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
230                     #{item}
231                 </foreach>
232             </if>
233         </where>
234     </select>
14cb32 235
a6de49 236     <select id="getMathPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
H 237         SELECT
238         t1.point_no,
239         t1.point_name,
240         t1.default_value,
dbd8a0 241         t1.unittransfactor,
a6de49 242         t1.point_type,
H 243         t1.data_type,
244         t1.store_type,
eef888 245         t1.minfreqid,
a6de49 246         t2.expression
H 247         FROM t_da_point t1
248         LEFT JOIN t_da_math_point t2 ON t2.point_id = t1.id
249         <where>
250             t1.point_type =  #{pointType}
251             <if test="isEnable != null">
252                 AND t1.is_enable = #{isEnable}
253             </if>
254             <if test="minfreqid != null and minfreqid != ''">
255                 AND t1.minfreqid = #{minfreqid}
256             </if>
d64649 257             <if test="pointNos != null">
258                 AND t1.point_no in
259                 <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
260                     #{item}
261                 </foreach>
262             </if>
a6de49 263         </where>
H 264     </select>
265
56dba6 266     <select id="getCumulatePoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
267         SELECT
268         t1.point_no,
269         t1.point_name,
270         t1.default_value,
271         t1.point_type,
272         t1.data_type,
273         t1.store_type,
274         t1.minfreqid,
275         t2.moment_point,
276         t2.length,
277         t2.divisor
278         FROM t_da_point t1
279         LEFT JOIN t_da_cumulate_point t2 ON t2.point_id = t1.id
280         <where>
281             t1.point_type =  #{pointType}
282             <if test="isEnable != null">
283                 AND t1.is_enable = #{isEnable}
284             </if>
285             <if test="minfreqid != null and minfreqid != ''">
286                 AND t1.minfreqid = #{minfreqid}
287             </if>
d64649 288             <if test="pointNos != null">
289                 AND t1.point_no in
290                 <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
291                     #{item}
292                 </foreach>
293             </if>
56dba6 294         </where>
295     </select>
48c064 296     <select id="getPointPage" parameterType="map" resultType="com.iailab.module.data.api.point.dto.ApiPointDTO">
L 297         select point_no pointNo,point_name pointName from t_da_point
298         <where>
299             point_no in
300             <foreach item="value" collection="paramsMap.values" separator="," open="(" close=")">
301                 '${value}'
302             </foreach>
303         </where>
304     </select>
56dba6 305
a6de49 306 </mapper>