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