重构
This commit is contained in:
@ -213,7 +213,8 @@
|
||||
</select>
|
||||
|
||||
<select id="getPointNameList" resultType="com.xzzn.ems.domain.vo.GeneralQueryPointOptionVo">
|
||||
select point_name as pointName,
|
||||
select point_id as pointId,
|
||||
point_name as pointName,
|
||||
data_key as dataKey,
|
||||
point_desc as pointDesc
|
||||
from ems_point_config
|
||||
@ -237,8 +238,8 @@
|
||||
or point_desc like concat('%', #{pointName}, '%')
|
||||
)
|
||||
</if>
|
||||
group by point_name, data_key, point_desc
|
||||
order by point_name asc, data_key asc
|
||||
group by point_id, point_name, data_key, point_desc
|
||||
order by point_id asc, point_name asc, data_key asc
|
||||
</select>
|
||||
|
||||
<select id="getConfigListForGeneralQuery" resultMap="EmsPointConfigResult">
|
||||
@ -250,21 +251,31 @@
|
||||
#{siteId}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="deviceCategory != null and deviceCategory != ''">
|
||||
and device_category = #{deviceCategory}
|
||||
</if>
|
||||
<if test="pointNames != null and pointNames.size() > 0">
|
||||
and point_name in
|
||||
<foreach collection="pointNames" item="pointName" open="(" separator="," close=")">
|
||||
#{pointName}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="deviceIds != null and deviceIds.size() > 0">
|
||||
and device_id in
|
||||
<foreach collection="deviceIds" item="deviceId" open="(" separator="," close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</if>
|
||||
<choose>
|
||||
<when test="pointIds != null and pointIds.size() > 0">
|
||||
and point_id in
|
||||
<foreach collection="pointIds" item="pointId" open="(" separator="," close=")">
|
||||
#{pointId}
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
<if test="deviceCategory != null and deviceCategory != ''">
|
||||
and device_category = #{deviceCategory}
|
||||
</if>
|
||||
<if test="pointNames != null and pointNames.size() > 0">
|
||||
and point_name in
|
||||
<foreach collection="pointNames" item="pointName" open="(" separator="," close=")">
|
||||
#{pointName}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="deviceIds != null and deviceIds.size() > 0">
|
||||
and device_id in
|
||||
<foreach collection="deviceIds" item="deviceId" open="(" separator="," close=")">
|
||||
#{deviceId}
|
||||
</foreach>
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="selectBySiteIdAndPointIds" resultMap="EmsPointConfigResult">
|
||||
|
||||
@ -162,4 +162,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where site_id = #{templateSiteId}
|
||||
</insert>
|
||||
|
||||
<delete id="deleteByScope">
|
||||
delete from ems_point_enum_match
|
||||
where site_id = #{siteId}
|
||||
and device_category = #{deviceCategory}
|
||||
and match_field = #{matchField}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -14,27 +14,23 @@
|
||||
|
||||
<insert id="upsertHistoryJsonByMinute">
|
||||
insert into ${tableName} (
|
||||
site_id, statis_minute, data_json, create_by, create_time, update_by, update_time
|
||||
site_id, statis_minute, data_json,
|
||||
hot_soc, hot_total_active_power, hot_total_reactive_power, hot_day_charged_cap, hot_day_dis_charged_cap,
|
||||
create_by, create_time, update_by, update_time
|
||||
) values (
|
||||
#{siteId}, #{statisMinute}, #{dataJson}, #{operName}, now(), #{operName}, now()
|
||||
#{siteId}, #{statisMinute}, #{dataJson},
|
||||
#{hotSoc}, #{hotTotalActivePower}, #{hotTotalReactivePower}, #{hotDayChargedCap}, #{hotDayDisChargedCap},
|
||||
#{operName}, now(), #{operName}, now()
|
||||
)
|
||||
on duplicate key update
|
||||
data_json = values(data_json),
|
||||
hot_soc = values(hot_soc),
|
||||
hot_total_active_power = values(hot_total_active_power),
|
||||
hot_total_reactive_power = values(hot_total_reactive_power),
|
||||
hot_day_charged_cap = values(hot_day_charged_cap),
|
||||
hot_day_dis_charged_cap = values(hot_day_dis_charged_cap),
|
||||
update_by = values(update_by),
|
||||
update_time = now()
|
||||
</insert>
|
||||
|
||||
<update id="updateHistoryHotColumns">
|
||||
update ${tableName}
|
||||
set hot_soc = #{hotSoc},
|
||||
hot_total_active_power = #{hotTotalActivePower},
|
||||
hot_total_reactive_power = #{hotTotalReactivePower},
|
||||
hot_day_charged_cap = #{hotDayChargedCap},
|
||||
hot_day_dis_charged_cap = #{hotDayDisChargedCap},
|
||||
update_by = #{operName},
|
||||
update_time = now()
|
||||
where site_id = #{siteId}
|
||||
and statis_minute = #{statisMinute}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
<result property="id" column="id"/>
|
||||
<result property="siteId" column="site_id"/>
|
||||
<result property="fieldCode" column="field_code"/>
|
||||
<result property="deviceId" column="device_id"/>
|
||||
<result property="dataPoint" column="data_point"/>
|
||||
<result property="fixedDataPoint" column="fixed_data_point"/>
|
||||
<result property="useFixedDisplay" column="use_fixed_display"/>
|
||||
@ -19,7 +20,7 @@
|
||||
</resultMap>
|
||||
|
||||
<select id="selectBySiteId" resultMap="EmsSiteMonitorPointMatchResult">
|
||||
select id, site_id, field_code, data_point, fixed_data_point, use_fixed_display, create_by, create_time, update_by, update_time, remark
|
||||
select id, site_id, field_code, device_id, data_point, fixed_data_point, use_fixed_display, create_by, create_time, update_by, update_time, remark
|
||||
from ems_site_monitor_point_match
|
||||
where site_id = #{siteId}
|
||||
order by id asc
|
||||
@ -32,10 +33,10 @@
|
||||
|
||||
<insert id="insertBatch">
|
||||
insert into ems_site_monitor_point_match
|
||||
(site_id, field_code, data_point, fixed_data_point, use_fixed_display, create_by, create_time, update_by, update_time)
|
||||
(site_id, field_code, device_id, data_point, fixed_data_point, use_fixed_display, create_by, create_time, update_by, update_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.siteId}, #{item.fieldCode}, #{item.dataPoint}, #{item.fixedDataPoint}, #{item.useFixedDisplay}, #{item.createBy}, now(), #{item.updateBy}, now())
|
||||
(#{item.siteId}, #{item.fieldCode}, #{item.deviceId}, #{item.dataPoint}, #{item.fixedDataPoint}, #{item.useFixedDisplay}, #{item.createBy}, now(), #{item.updateBy}, now())
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
@ -134,17 +134,17 @@
|
||||
</select>
|
||||
|
||||
<select id="getAllSiteDeviceList" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteDeviceListVo">
|
||||
select es.site_id as siteId,es.site_name as siteName,
|
||||
select ed.site_id as siteId,
|
||||
ed.device_id as deviceId,ed.device_name as deviceName,
|
||||
ed.device_type as deviceType,ed.device_status as deviceStatus,ed.work_status as workStatus,
|
||||
ed.device_category as deviceCategory,
|
||||
ed.picture_url as pictureUrl,
|
||||
ed.id,
|
||||
ed.parent_id as parentId
|
||||
from ems_site_setting es INNER JOIN ems_devices_setting ed on es.site_id = ed.site_id
|
||||
from ems_devices_setting ed
|
||||
where 1=1
|
||||
<if test="siteId != null and siteId != ''">
|
||||
and es.site_id = #{siteId}
|
||||
and ed.site_id = #{siteId}
|
||||
</if>
|
||||
<if test="deviceCategory != null and deviceCategory != ''">
|
||||
and ed.device_category = #{deviceCategory}
|
||||
@ -153,18 +153,19 @@
|
||||
</select>
|
||||
|
||||
<select id="getAllSiteDeviceListNoDisp" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteDeviceListVo">
|
||||
select es.site_id as siteId,es.site_name as siteName,
|
||||
select ed.site_id as siteId,
|
||||
ed.device_id as deviceId,ed.device_name as deviceName,
|
||||
ed.device_type as deviceType,ed.device_status as deviceStatus,ed.work_status as workStatus,
|
||||
ed.device_category as deviceCategory,
|
||||
ed.picture_url as pictureUrl,
|
||||
ed.id,
|
||||
ed.parent_id as parentId
|
||||
from ems_site_setting es INNER JOIN ems_devices_setting ed on es.site_id = ed.site_id and (ed.display_flg is null or ed.display_flg != '1')
|
||||
from ems_devices_setting ed
|
||||
where 1 = 1
|
||||
<if test="siteId != null and siteId != ''">
|
||||
and es.site_id = #{siteId}
|
||||
and ed.site_id = #{siteId}
|
||||
</if>
|
||||
and (ed.display_flg is null or ed.display_flg != '1')
|
||||
<if test="deviceCategory != null and deviceCategory != ''">
|
||||
and ed.device_category = #{deviceCategory}
|
||||
</if>
|
||||
@ -173,4 +174,4 @@
|
||||
<select id="getAllSiteId" resultType="String">
|
||||
select distinct site_id from ems_site_setting
|
||||
</select>
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
||||
@ -14,6 +14,12 @@
|
||||
<result property="antiReverseUp" column="anti_reverse_up"/>
|
||||
<result property="antiReversePowerDownPercent" column="anti_reverse_power_down_percent"/>
|
||||
<result property="antiReverseHardStopThreshold" column="anti_reverse_hard_stop_threshold"/>
|
||||
<result property="powerSetMultiplier" column="power_set_multiplier"/>
|
||||
<result property="protectInterveneEnable" column="protect_intervene_enable"/>
|
||||
<result property="protectL1DeratePercent" column="protect_l1_derate_percent"/>
|
||||
<result property="protectRecoveryStableSeconds" column="protect_recovery_stable_seconds"/>
|
||||
<result property="protectL3LatchEnable" column="protect_l3_latch_enable"/>
|
||||
<result property="protectConflictPolicy" column="protect_conflict_policy"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
@ -31,6 +37,12 @@
|
||||
anti_reverse_up,
|
||||
anti_reverse_power_down_percent,
|
||||
anti_reverse_hard_stop_threshold,
|
||||
power_set_multiplier,
|
||||
protect_intervene_enable,
|
||||
protect_l1_derate_percent,
|
||||
protect_recovery_stable_seconds,
|
||||
protect_l3_latch_enable,
|
||||
protect_conflict_policy,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
@ -56,6 +68,12 @@
|
||||
<if test="antiReverseUp != null">anti_reverse_up,</if>
|
||||
<if test="antiReversePowerDownPercent != null">anti_reverse_power_down_percent,</if>
|
||||
<if test="antiReverseHardStopThreshold != null">anti_reverse_hard_stop_threshold,</if>
|
||||
<if test="powerSetMultiplier != null">power_set_multiplier,</if>
|
||||
<if test="protectInterveneEnable != null">protect_intervene_enable,</if>
|
||||
<if test="protectL1DeratePercent != null">protect_l1_derate_percent,</if>
|
||||
<if test="protectRecoveryStableSeconds != null">protect_recovery_stable_seconds,</if>
|
||||
<if test="protectL3LatchEnable != null">protect_l3_latch_enable,</if>
|
||||
<if test="protectConflictPolicy != null and protectConflictPolicy != ''">protect_conflict_policy,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
@ -71,6 +89,12 @@
|
||||
<if test="antiReverseUp != null">#{antiReverseUp},</if>
|
||||
<if test="antiReversePowerDownPercent != null">#{antiReversePowerDownPercent},</if>
|
||||
<if test="antiReverseHardStopThreshold != null">#{antiReverseHardStopThreshold},</if>
|
||||
<if test="powerSetMultiplier != null">#{powerSetMultiplier},</if>
|
||||
<if test="protectInterveneEnable != null">#{protectInterveneEnable},</if>
|
||||
<if test="protectL1DeratePercent != null">#{protectL1DeratePercent},</if>
|
||||
<if test="protectRecoveryStableSeconds != null">#{protectRecoveryStableSeconds},</if>
|
||||
<if test="protectL3LatchEnable != null">#{protectL3LatchEnable},</if>
|
||||
<if test="protectConflictPolicy != null and protectConflictPolicy != ''">#{protectConflictPolicy},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
@ -89,6 +113,12 @@
|
||||
<if test="antiReverseUp != null">anti_reverse_up = #{antiReverseUp},</if>
|
||||
<if test="antiReversePowerDownPercent != null">anti_reverse_power_down_percent = #{antiReversePowerDownPercent},</if>
|
||||
<if test="antiReverseHardStopThreshold != null">anti_reverse_hard_stop_threshold = #{antiReverseHardStopThreshold},</if>
|
||||
<if test="powerSetMultiplier != null">power_set_multiplier = #{powerSetMultiplier},</if>
|
||||
<if test="protectInterveneEnable != null">protect_intervene_enable = #{protectInterveneEnable},</if>
|
||||
<if test="protectL1DeratePercent != null">protect_l1_derate_percent = #{protectL1DeratePercent},</if>
|
||||
<if test="protectRecoveryStableSeconds != null">protect_recovery_stable_seconds = #{protectRecoveryStableSeconds},</if>
|
||||
<if test="protectL3LatchEnable != null">protect_l3_latch_enable = #{protectL3LatchEnable},</if>
|
||||
<if test="protectConflictPolicy != null and protectConflictPolicy != ''">protect_conflict_policy = #{protectConflictPolicy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
|
||||
Reference in New Issue
Block a user