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