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