PCS抽数逻辑
This commit is contained in:
@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xzzn.ems.mapper.EmsPcsBranchDataMapper">
|
||||
|
||||
<resultMap type="EmsPcsBranchData" id="EmsPcsBranchDataResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="dischargeStatus" column="discharge_status" />
|
||||
<result property="dcPower" column="dc_power" />
|
||||
<result property="dcVoltage" column="dc_voltage" />
|
||||
<result property="dcCurrent" column="dc_current" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="remark" column="remark" />
|
||||
<result property="siteId" column="site_id" />
|
||||
<result property="deviceId" column="device_id" />
|
||||
<result property="branchId" column="branch_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmsPcsBranchDataVo">
|
||||
select id, discharge_status, dc_power, dc_voltage, dc_current, create_by, create_time, update_by, update_time, remark, site_id, device_id, branch_id from ems_pcs_branch_data
|
||||
</sql>
|
||||
|
||||
<select id="selectEmsPcsBranchDataList" parameterType="EmsPcsBranchData" resultMap="EmsPcsBranchDataResult">
|
||||
<include refid="selectEmsPcsBranchDataVo"/>
|
||||
<where>
|
||||
<if test="dischargeStatus != null and dischargeStatus != ''"> and discharge_status = #{dischargeStatus}</if>
|
||||
<if test="dcPower != null "> and dc_power = #{dcPower}</if>
|
||||
<if test="dcVoltage != null "> and dc_voltage = #{dcVoltage}</if>
|
||||
<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="branchId != null "> and branch_id = #{branchId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEmsPcsBranchDataById" parameterType="Long" resultMap="EmsPcsBranchDataResult">
|
||||
<include refid="selectEmsPcsBranchDataVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmsPcsBranchData" parameterType="EmsPcsBranchData" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into ems_pcs_branch_data
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="dischargeStatus != null">discharge_status,</if>
|
||||
<if test="dcPower != null">dc_power,</if>
|
||||
<if test="dcVoltage != null">dc_voltage,</if>
|
||||
<if test="dcCurrent != null">dc_current,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="siteId != null">site_id,</if>
|
||||
<if test="deviceId != null">device_id,</if>
|
||||
<if test="branchId != null">branch_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="dischargeStatus != null">#{dischargeStatus},</if>
|
||||
<if test="dcPower != null">#{dcPower},</if>
|
||||
<if test="dcVoltage != null">#{dcVoltage},</if>
|
||||
<if test="dcCurrent != null">#{dcCurrent},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="siteId != null">#{siteId},</if>
|
||||
<if test="deviceId != null">#{deviceId},</if>
|
||||
<if test="branchId != null">#{branchId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmsPcsBranchData" parameterType="EmsPcsBranchData">
|
||||
update ems_pcs_branch_data
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="dischargeStatus != null">discharge_status = #{dischargeStatus},</if>
|
||||
<if test="dcPower != null">dc_power = #{dcPower},</if>
|
||||
<if test="dcVoltage != null">dc_voltage = #{dcVoltage},</if>
|
||||
<if test="dcCurrent != null">dc_current = #{dcCurrent},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<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="branchId != null">branch_id = #{branchId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmsPcsBranchDataById" parameterType="Long">
|
||||
delete from ems_pcs_branch_data where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmsPcsBranchDataByIds" parameterType="String">
|
||||
delete from ems_pcs_branch_data where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="getPcsBranchInfoList" resultType="com.xzzn.ems.domain.vo.PcsBranchInfo">
|
||||
select tmp.branch_id as branchId, tmp.discharge_status as dischargeStatus,
|
||||
tmp.dc_power as dcPower, tmp.dc_voltage as dcVoltage,
|
||||
tmp.dc_current as dcCurrent, tmp.site_id as siteId, tmp.device_id as deviceId
|
||||
from ems_pcs_branch_data tmp
|
||||
where tmp.site_id = #{siteId}
|
||||
and tmp.device_id = #{deviceId}
|
||||
and tmp.update_time = (select MAX(t.update_time) FROM ems_pcs_branch_data t where t.site_id = tmp.site_id
|
||||
and t.device_id = tmp.device_id and t.branch_id = tmp.branch_id)
|
||||
order by tmp.branch_id
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user