潘志宝
2024-10-15 856d69ce678173e0a8e165bcb0135037d20b48ee
提交 | 用户 | 时间
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.value_type,
14       t1.unit,
15       t1.unittransfactor,
16       t1.default_value,
17       t1.max_value,
18       t1.min_value,
19       t1.minfreqid,
20       t1.remark,
21       t1.is_enable,
22       t1.creator,
23       t1.create_time,
24       t1.updater,
25       t1.update_time,
26       t2.source_type,
27       t3.source_name,
28       t2.tag_no
29       from t_da_point t1
30       left join t_da_measure_point t2 on t2.point_id = t1.id
31       left join (
32         select id source_id,server_name source_name
33         from t_channel_opcua_device
34         union
35         select id source_id, name source_name
36         from t_channel_modbus_device
37         union
38         select id source_id, code source_name
39         from t_http_api
40         union
41         select id source_id, instance_name source_name
42         from t_channel_kio_device
43       ) t3 on t3.source_id = t2.source_id
44         <where>
45             <if test="params.pointNo != null and params.pointNo != ''">
46                 and t1.point_no like concat('%', #{params.pointNo}, '%')
47             </if>
48             <if test="params.pointName != null and params.pointName != ''">
49                 and t1.point_name like concat('%', #{params.pointName}, '%')
50             </if>
51             <if test="params.pointType != null and params.pointType != ''">
52                 and t1.point_type = #{params.pointType}
53             </if>
54             <if test="params.dataType != null and params.dataType != ''">
55                 and t1.data_type = #{params.dataType}
56             </if>
57             <if test="params.sourceName != null and params.sourceName != ''">
58                 and t3.source_name like concat('%', #{params.sourceName}, '%')
59             </if>
60             <if test="params.tagNo != null and params.tagNo != ''">
61                 and t2.tag_no like concat('%', #{params.tagNo}, '%')
62             </if>
63             <if test="params.isEnable != null ">
64                 and t1.is_enable = #{params.isEnable}
65             </if>
66         </where>
250190 67         order by t1.create_time desc
a6de49 68     </select>
H 69
70     <select id="getConstantPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
71         SELECT
72         t1.point_no,
73         t1.point_name,
74         t1.default_value,
75         t1.point_type,
76         t1.store_type,
77         t1.data_type
78         FROM t_da_point t1
79         <where>
80             t1.point_type =  #{pointType}
81             <if test="isEnable != null">
82                 AND t1.is_enable = #{isEnable}
83             </if>
84             <if test="minfreqid != null and minfreqid != ''">
85                 AND t1.minfreqid = #{minfreqid}
86             </if>
87             <if test="pointNos != null">
88                 AND t1.point_no in
89                 <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
90                     #{item}
91                 </foreach>
92             </if>
93         </where>
94     </select>
95
96     <select id="getMeasurePoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
97         SELECT
98         t1.point_no,
99         t1.point_name,
100         t1.point_type,
101         t1.data_type,
102         t1.store_type,
103         t1.default_value,
104         t1.unittransfactor,
105         t1.max_value,
106         t1.min_value,
107         t2.source_type,
108         t2.source_id,
109         t3.source_name,
110         t2.tag_no
111         FROM t_da_point t1
112         LEFT JOIN t_da_measure_point t2 ON t2.point_id = t1.id
113         left join (
114             select id source_id,server_name source_name
115             from t_channel_opcua_device
116             union
117             select id source_id, name source_name
118             from t_channel_modbus_device
119             union
120             select id source_id, instance_name source_name
121             from t_channel_kio_device
122             union
123             select id source_id, code source_name
124             from t_http_api
125         ) t3 on t3.source_id = t2.source_id
126         <where>
127             t1.point_type =  #{pointType}
128             <if test="isEnable != null">
129                 AND t1.is_enable = #{isEnable}
130             </if>
131             <if test="minfreqid != null and minfreqid != ''">
132                 AND t1.minfreqid = #{minfreqid}
133             </if>
134             <if test="pointNo != null and pointNo != ''">
135                 AND t1.point_no = #{pointNo}
136             </if>
137             <if test="pointNos != null">
138                 AND t1.point_no in
139                 <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
140                     #{item}
141                 </foreach>
142             </if>
143         </where>
144     </select>
145     <select id="getMathPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
146         SELECT
147         t1.point_no,
148         t1.point_name,
149         t1.default_value,
150         t1.point_type,
151         t1.data_type,
152         t1.store_type,
153         t2.expression
154         FROM t_da_point t1
155         LEFT JOIN t_da_math_point t2 ON t2.point_id = t1.id
156         <where>
157             t1.point_type =  #{pointType}
158             <if test="isEnable != null">
159                 AND t1.is_enable = #{isEnable}
160             </if>
161             <if test="minfreqid != null and minfreqid != ''">
162                 AND t1.minfreqid = #{minfreqid}
163             </if>
164         </where>
165     </select>
166
167 </mapper>