136 lines
7.8 KiB
XML
136 lines
7.8 KiB
XML
<?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.EmsCoolingDataMapper">
|
|
|
|
<resultMap type="EmsCoolingData" id="EmsCoolingDataResult">
|
|
<result property="id" column="id" />
|
|
<result property="systemName" column="system_name" />
|
|
<result property="workMode" column="work_mode" />
|
|
<result property="currentTemperature" column="current_temperature" />
|
|
<result property="heatingStartPoint" column="heating_start_point" />
|
|
<result property="coolingStartPoint" column="cooling_start_point" />
|
|
<result property="highTempAlarmPoint" column="high_temp_alarm_point" />
|
|
<result property="heatingStopPoint" column="heating_stop_point" />
|
|
<result property="coolingStopPoint" column="cooling_stop_point" />
|
|
<result property="lowTempAlarmPoint" column="low_temp_alarm_point" />
|
|
<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" />
|
|
</resultMap>
|
|
|
|
<sql id="selectEmsCoolingDataVo">
|
|
select id, system_name, work_mode, current_temperature, heating_start_point, cooling_start_point, high_temp_alarm_point, heating_stop_point, cooling_stop_point, low_temp_alarm_point, create_by, create_time, update_by, update_time, remark, site_id, device_id from ems_cooling_data
|
|
</sql>
|
|
|
|
<select id="selectEmsCoolingDataList" parameterType="EmsCoolingData" resultMap="EmsCoolingDataResult">
|
|
<include refid="selectEmsCoolingDataVo"/>
|
|
<where>
|
|
<if test="systemName != null and systemName != ''"> and system_name like concat('%', #{systemName}, '%')</if>
|
|
<if test="workMode != null and workMode != ''"> and work_mode = #{workMode}</if>
|
|
<if test="currentTemperature != null "> and current_temperature = #{currentTemperature}</if>
|
|
<if test="heatingStartPoint != null "> and heating_start_point = #{heatingStartPoint}</if>
|
|
<if test="coolingStartPoint != null "> and cooling_start_point = #{coolingStartPoint}</if>
|
|
<if test="highTempAlarmPoint != null "> and high_temp_alarm_point = #{highTempAlarmPoint}</if>
|
|
<if test="heatingStopPoint != null "> and heating_stop_point = #{heatingStopPoint}</if>
|
|
<if test="coolingStopPoint != null "> and cooling_stop_point = #{coolingStopPoint}</if>
|
|
<if test="lowTempAlarmPoint != null "> and low_temp_alarm_point = #{lowTempAlarmPoint}</if>
|
|
<if test="siteId != null "> and site_id = #{siteId}</if>
|
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectEmsCoolingDataById" parameterType="Long" resultMap="EmsCoolingDataResult">
|
|
<include refid="selectEmsCoolingDataVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertEmsCoolingData" parameterType="EmsCoolingData" useGeneratedKeys="true" keyProperty="id">
|
|
insert into ems_cooling_data
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="systemName != null">system_name,</if>
|
|
<if test="workMode != null">work_mode,</if>
|
|
<if test="currentTemperature != null">current_temperature,</if>
|
|
<if test="heatingStartPoint != null">heating_start_point,</if>
|
|
<if test="coolingStartPoint != null">cooling_start_point,</if>
|
|
<if test="highTempAlarmPoint != null">high_temp_alarm_point,</if>
|
|
<if test="heatingStopPoint != null">heating_stop_point,</if>
|
|
<if test="coolingStopPoint != null">cooling_stop_point,</if>
|
|
<if test="lowTempAlarmPoint != null">low_temp_alarm_point,</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>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="systemName != null">#{systemName},</if>
|
|
<if test="workMode != null">#{workMode},</if>
|
|
<if test="currentTemperature != null">#{currentTemperature},</if>
|
|
<if test="heatingStartPoint != null">#{heatingStartPoint},</if>
|
|
<if test="coolingStartPoint != null">#{coolingStartPoint},</if>
|
|
<if test="highTempAlarmPoint != null">#{highTempAlarmPoint},</if>
|
|
<if test="heatingStopPoint != null">#{heatingStopPoint},</if>
|
|
<if test="coolingStopPoint != null">#{coolingStopPoint},</if>
|
|
<if test="lowTempAlarmPoint != null">#{lowTempAlarmPoint},</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>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateEmsCoolingData" parameterType="EmsCoolingData">
|
|
update ems_cooling_data
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="systemName != null">system_name = #{systemName},</if>
|
|
<if test="workMode != null">work_mode = #{workMode},</if>
|
|
<if test="currentTemperature != null">current_temperature = #{currentTemperature},</if>
|
|
<if test="heatingStartPoint != null">heating_start_point = #{heatingStartPoint},</if>
|
|
<if test="coolingStartPoint != null">cooling_start_point = #{coolingStartPoint},</if>
|
|
<if test="highTempAlarmPoint != null">high_temp_alarm_point = #{highTempAlarmPoint},</if>
|
|
<if test="heatingStopPoint != null">heating_stop_point = #{heatingStopPoint},</if>
|
|
<if test="coolingStopPoint != null">cooling_stop_point = #{coolingStopPoint},</if>
|
|
<if test="lowTempAlarmPoint != null">low_temp_alarm_point = #{lowTempAlarmPoint},</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>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteEmsCoolingDataById" parameterType="Long">
|
|
delete from ems_cooling_data where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteEmsCoolingDataByIds" parameterType="String">
|
|
delete from ems_cooling_data where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<select id="getCoolingDataList" parameterType="Long" resultMap="EmsCoolingDataResult">
|
|
select t.*
|
|
from ems_cooling_data t
|
|
where t.site_id = 1
|
|
and t.update_time = (
|
|
select MAX(tcd.update_time) from ems_cooling_data tcd where tcd.site_id = t.site_id and tcd.device_id = t.device_id)
|
|
order by t.system_name
|
|
|
|
</select>
|
|
</mapper> |