重构
This commit is contained in:
@ -22,6 +22,12 @@
|
||||
<result property="isAlarm" column="is_alarm"/>
|
||||
<result property="pointType" column="point_type"/>
|
||||
<result property="calcExpression" column="calc_expression"/>
|
||||
<result property="collectEnabled" column="collect_enabled"/>
|
||||
<result property="collectSource" column="collect_source"/>
|
||||
<result property="modbusRegisterType" column="modbus_register_type"/>
|
||||
<result property="modbusDataType" column="modbus_data_type"/>
|
||||
<result property="modbusReadOrder" column="modbus_read_order"/>
|
||||
<result property="modbusGroup" column="modbus_group"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@ -32,6 +38,7 @@
|
||||
<sql id="selectEmsPointConfigVo">
|
||||
select id, point_id, site_id, device_category, device_id, point_name, data_key, point_desc, register_address,
|
||||
data_unit, data_a, data_k, data_b, data_bit, is_alarm, point_type, calc_expression,
|
||||
collect_enabled, collect_source, modbus_register_type, modbus_data_type, modbus_read_order, modbus_group,
|
||||
create_by, create_time, update_by, update_time, remark
|
||||
from ems_point_config
|
||||
</sql>
|
||||
@ -51,6 +58,10 @@
|
||||
<if test="dataKey != null and dataKey != ''">and data_key like concat('%', #{dataKey}, '%')</if>
|
||||
<if test="pointDesc != null and pointDesc != ''">and point_desc like concat('%', #{pointDesc}, '%')</if>
|
||||
<if test="pointType != null and pointType != ''">and point_type = #{pointType}</if>
|
||||
<if test="collectEnabled != null">and collect_enabled = #{collectEnabled}</if>
|
||||
<if test="collectSource != null and collectSource != ''">and collect_source = #{collectSource}</if>
|
||||
<if test="modbusRegisterType != null and modbusRegisterType != ''">and modbus_register_type = #{modbusRegisterType}</if>
|
||||
<if test="modbusDataType != null and modbusDataType != ''">and modbus_data_type = #{modbusDataType}</if>
|
||||
<if test="registerAddress != null and registerAddress != ''">and register_address = #{registerAddress}</if>
|
||||
</where>
|
||||
order by update_time desc, id desc
|
||||
@ -75,6 +86,12 @@
|
||||
<if test="isAlarm != null">is_alarm,</if>
|
||||
<if test="pointType != null">point_type,</if>
|
||||
<if test="calcExpression != null">calc_expression,</if>
|
||||
<if test="collectEnabled != null">collect_enabled,</if>
|
||||
<if test="collectSource != null">collect_source,</if>
|
||||
<if test="modbusRegisterType != null">modbus_register_type,</if>
|
||||
<if test="modbusDataType != null">modbus_data_type,</if>
|
||||
<if test="modbusReadOrder != null">modbus_read_order,</if>
|
||||
<if test="modbusGroup != null">modbus_group,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
@ -98,6 +115,12 @@
|
||||
<if test="isAlarm != null">#{isAlarm},</if>
|
||||
<if test="pointType != null">#{pointType},</if>
|
||||
<if test="calcExpression != null">#{calcExpression},</if>
|
||||
<if test="collectEnabled != null">#{collectEnabled},</if>
|
||||
<if test="collectSource != null">#{collectSource},</if>
|
||||
<if test="modbusRegisterType != null">#{modbusRegisterType},</if>
|
||||
<if test="modbusDataType != null">#{modbusDataType},</if>
|
||||
<if test="modbusReadOrder != null">#{modbusReadOrder},</if>
|
||||
<if test="modbusGroup != null">#{modbusGroup},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
@ -110,6 +133,7 @@
|
||||
insert into ems_point_config (
|
||||
point_id, site_id, device_category, device_id, point_name, data_key, point_desc, register_address,
|
||||
data_unit, data_a, data_k, data_b, data_bit, is_alarm, point_type, calc_expression,
|
||||
collect_enabled, collect_source, modbus_register_type, modbus_data_type, modbus_read_order, modbus_group,
|
||||
create_by, create_time, update_by, update_time, remark
|
||||
)
|
||||
values
|
||||
@ -131,6 +155,12 @@
|
||||
#{item.isAlarm},
|
||||
#{item.pointType},
|
||||
#{item.calcExpression},
|
||||
#{item.collectEnabled},
|
||||
#{item.collectSource},
|
||||
#{item.modbusRegisterType},
|
||||
#{item.modbusDataType},
|
||||
#{item.modbusReadOrder},
|
||||
#{item.modbusGroup},
|
||||
#{item.createBy},
|
||||
now(),
|
||||
#{item.updateBy},
|
||||
@ -159,6 +189,12 @@
|
||||
<if test="isAlarm != null">is_alarm = #{isAlarm},</if>
|
||||
<if test="pointType != null">point_type = #{pointType},</if>
|
||||
<if test="calcExpression != null">calc_expression = #{calcExpression},</if>
|
||||
<if test="collectEnabled != null">collect_enabled = #{collectEnabled},</if>
|
||||
<if test="collectSource != null">collect_source = #{collectSource},</if>
|
||||
<if test="modbusRegisterType != null">modbus_register_type = #{modbusRegisterType},</if>
|
||||
<if test="modbusDataType != null">modbus_data_type = #{modbusDataType},</if>
|
||||
<if test="modbusReadOrder != null">modbus_read_order = #{modbusReadOrder},</if>
|
||||
<if test="modbusGroup != null">modbus_group = #{modbusGroup},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
@ -192,11 +228,13 @@
|
||||
insert into ems_point_config (
|
||||
point_id, site_id, device_category, device_id, point_name, data_key, point_desc, register_address,
|
||||
data_unit, data_a, data_k, data_b, data_bit, is_alarm, point_type, calc_expression,
|
||||
collect_enabled, collect_source, modbus_register_type, modbus_data_type, modbus_read_order, modbus_group,
|
||||
create_by, create_time, update_by, update_time, remark
|
||||
)
|
||||
select
|
||||
concat('PT_', replace(uuid(), '-', '')), #{targetSiteId}, device_category, device_id, point_name, data_key, point_desc, register_address,
|
||||
data_unit, data_a, data_k, data_b, data_bit, is_alarm, point_type, calc_expression,
|
||||
collect_enabled, collect_source, modbus_register_type, modbus_data_type, modbus_read_order, modbus_group,
|
||||
#{operName}, now(), #{operName}, now(), remark
|
||||
from ems_point_config
|
||||
where site_id = #{templateSiteId}
|
||||
@ -287,4 +325,19 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectModbusCollectPointConfigs" resultMap="EmsPointConfigResult">
|
||||
<include refid="selectEmsPointConfigVo"/>
|
||||
where collect_enabled = 1
|
||||
and collect_source = 'MODBUS'
|
||||
and (point_type is null or point_type <> 'calc')
|
||||
and (is_alarm is null or is_alarm = 0)
|
||||
and register_address is not null and register_address <> ''
|
||||
and modbus_register_type is not null and modbus_register_type <> ''
|
||||
and modbus_data_type is not null and modbus_data_type <> ''
|
||||
<if test="siteId != null and siteId != ''">
|
||||
and site_id = #{siteId}
|
||||
</if>
|
||||
order by site_id asc, device_id asc, modbus_read_order asc, id asc
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user