PCS抽数逻辑
This commit is contained in:
@ -40,10 +40,11 @@
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="dateMonth" column="date_month" />
|
||||
<result property="dateDay" column="date_day" />
|
||||
<result property="communicationStatus" column="communication_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsPcsDataVo">
|
||||
select id, data_update_time, work_status, grid_status, device_status, control_mode, total_active_power, daily_ac_charge_energy, a_phase_voltage, a_phase_current, total_reactive_power, daily_ac_discharge_energy, b_phase_voltage, b_phase_current, total_apparent_power, pcs_module_temperature, c_phase_voltage, c_phase_current, total_power_factor, pcs_environment_temperature, ac_frequency, branch_status, discharge_status, dc_power, dc_voltage, dc_current, create_by, create_time, update_by, update_time, remark, site_id, device_id, date_month, date_day from ems_pcs_data
|
||||
select id, data_update_time, work_status, grid_status, device_status, control_mode, total_active_power, daily_ac_charge_energy, a_phase_voltage, a_phase_current, total_reactive_power, daily_ac_discharge_energy, b_phase_voltage, b_phase_current, total_apparent_power, pcs_module_temperature, c_phase_voltage, c_phase_current, total_power_factor, pcs_environment_temperature, ac_frequency, branch_status, discharge_status, dc_power, dc_voltage, dc_current, create_by, create_time, update_by, update_time, remark, site_id, device_id, date_month, date_day, communication_status from ems_pcs_data
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsPcsDataList" parameterType="EmsPcsData" resultMap="EmsPcsDataResult">
|
||||
@ -76,6 +77,9 @@
|
||||
<if test="dcCurrent != null "> and dc_current = #{dcCurrent}</if>
|
||||
<if test="siteId != null "> and site_id = #{siteId}</if>
|
||||
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||
<if test="dateMonth != null "> and date_month = #{dateMonth}</if>
|
||||
<if test="dateDay != null "> and date_day = #{dateDay}</if>
|
||||
<if test="communicationStatus != null and communicationStatus != ''"> and communication_status = #{communicationStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -119,6 +123,9 @@
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="dateMonth != null">date_month,</if>
|
||||
<if test="dateDay != null">date_day,</if>
|
||||
<if test="communicationStatus != null">communication_status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dataUpdateTime != null">#{dataUpdateTime},</if>
|
||||
@ -153,6 +160,9 @@
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="dateMonth != null">#{dateMonth},</if>
|
||||
<if test="dateDay != null">#{dateDay},</if>
|
||||
<if test="communicationStatus != null">#{communicationStatus},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -191,6 +201,9 @@
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="siteId != null">site_id = #{siteId},</if>
|
||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||
<if test="dateMonth != null">date_month = #{dateMonth},</if>
|
||||
<if test="dateDay != null">date_day = #{dateDay},</if>
|
||||
<if test="communicationStatus != null">communication_status = #{communicationStatus},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -256,8 +269,11 @@
|
||||
</select>
|
||||
|
||||
<select id="getPcsDetailInfoBySiteId" parameterType="Long" resultMap="EmsPcsDataResult">
|
||||
<include refid="selectEmsPcsDataVo"/>
|
||||
where site_id = #{siteId}
|
||||
order by data_update_time desc limit 1
|
||||
select tmp.*
|
||||
from ems_pcs_data tmp
|
||||
where tmp.site_id = #{siteId}
|
||||
and tmp.data_update_time = (select MAX(data_update_time) FROM ems_pcs_data where site_id = tmp.site_id
|
||||
and device_id = tmp.device_id)
|
||||
order by tmp.device_id
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user