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