houzhongjian
2024-10-30 a28ca3f36d0ace05966a8c0fac1e4b5fe921f882
提交 | 用户 | 时间
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>
250190 68         order by t1.create_time desc
a6de49 69     </select>
H 70
71     <select id="getConstantPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
72         SELECT
73         t1.point_no,
74         t1.point_name,
75         t1.default_value,
76         t1.point_type,
77         t1.store_type,
78         t1.data_type
79         FROM t_da_point t1
80         <where>
81             t1.point_type =  #{pointType}
82             <if test="isEnable != null">
83                 AND t1.is_enable = #{isEnable}
84             </if>
85             <if test="minfreqid != null and minfreqid != ''">
86                 AND t1.minfreqid = #{minfreqid}
87             </if>
88             <if test="pointNos != null">
89                 AND t1.point_no in
90                 <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
91                     #{item}
92                 </foreach>
93             </if>
94         </where>
95     </select>
96
97     <select id="getMeasurePoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
98         SELECT
99         t1.point_no,
100         t1.point_name,
101         t1.point_type,
102         t1.data_type,
103         t1.store_type,
104         t1.default_value,
105         t1.unittransfactor,
106         t1.max_value,
107         t1.min_value,
108         t2.source_type,
109         t2.source_id,
110         t3.source_name,
52487d 111         t2.tag_no,
L 112         t2.dimension,
113         t2.value_type
a6de49 114         FROM t_da_point t1
H 115         LEFT JOIN t_da_measure_point t2 ON t2.point_id = t1.id
116         left join (
117             select id source_id,server_name source_name
118             from t_channel_opcua_device
119             union
120             select id source_id, name source_name
121             from t_channel_modbus_device
122             union
123             select id source_id, instance_name source_name
124             from t_channel_kio_device
125             union
126             select id source_id, code source_name
127             from t_http_api
128         ) t3 on t3.source_id = t2.source_id
129         <where>
130             t1.point_type =  #{pointType}
131             <if test="isEnable != null">
132                 AND t1.is_enable = #{isEnable}
133             </if>
134             <if test="minfreqid != null and minfreqid != ''">
135                 AND t1.minfreqid = #{minfreqid}
136             </if>
137             <if test="pointNo != null and pointNo != ''">
138                 AND t1.point_no = #{pointNo}
139             </if>
140             <if test="pointNos != null">
141                 AND t1.point_no in
142                 <foreach collection="pointNos" item="item" index="item" open="(" close=")" separator=",">
143                     #{item}
144                 </foreach>
145             </if>
146         </where>
147     </select>
148     <select id="getMathPoint" resultType="com.iailab.module.data.point.dto.DaPointDTO">
149         SELECT
150         t1.point_no,
151         t1.point_name,
152         t1.default_value,
153         t1.point_type,
154         t1.data_type,
155         t1.store_type,
156         t2.expression
157         FROM t_da_point t1
158         LEFT JOIN t_da_math_point t2 ON t2.point_id = t1.id
159         <where>
160             t1.point_type =  #{pointType}
161             <if test="isEnable != null">
162                 AND t1.is_enable = #{isEnable}
163             </if>
164             <if test="minfreqid != null and minfreqid != ''">
165                 AND t1.minfreqid = #{minfreqid}
166             </if>
167         </where>
168     </select>
169
170 </mapper>