You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
186 lines
7.5 KiB
186 lines
7.5 KiB
<?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.psdc.mapper.PsdcControlLogMapper">
|
|
<resultMap type="com.psdc.entity.PsdcControlLog" id="PsdcControlLogMap">
|
|
<result property="controlLogId" column="control_log_id"/>
|
|
<result property="deviceId" column="device_id"/>
|
|
<result property="deviceName" column="device_name"/>
|
|
<result property="deviceSn" column="device_sn"/>
|
|
<result property="controlKey" column="control_key"/>
|
|
<result property="controlValue" column="control_value"/>
|
|
<result property="controlResult" column="control_result"/>
|
|
<result property="controlContext" column="control_context"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
</resultMap>
|
|
|
|
<!-- 通过ID查询单条数据 -->
|
|
<select id="queryById" resultMap="PsdcControlLogMap">
|
|
select control_log_id,
|
|
device_id,
|
|
device_name,
|
|
device_sn,
|
|
control_key,
|
|
control_value,
|
|
control_result,
|
|
control_context,
|
|
create_by,
|
|
create_time,
|
|
update_by,
|
|
update_time
|
|
from psdc_control_log
|
|
where control_log_id = #{controlLogId}
|
|
</select>
|
|
|
|
<!--分页查询指定行数据-->
|
|
<select id="queryControlLogList" parameterType="com.psdc.entity.PsdcControlLog" resultMap="PsdcControlLogMap">
|
|
select
|
|
control_log_id,device_id,device_name,device_sn,control_key,control_value,control_result,control_context,create_by,create_time,update_by,update_time
|
|
from psdc_control_log
|
|
<where>
|
|
<if test="controlLogId != null and controlLogId != ''">
|
|
and control_log_id = #{controlLogId}
|
|
</if>
|
|
<if test="deviceId != null and deviceId != ''">
|
|
and device_id = #{deviceId}
|
|
</if>
|
|
<if test="deviceName != null and deviceName != ''">
|
|
and device_name = #{deviceName}
|
|
</if>
|
|
<if test="deviceSn != null and deviceSn != ''">
|
|
and device_sn = #{deviceSn}
|
|
</if>
|
|
<if test="controlKey != null and controlKey != ''">
|
|
and control_key = #{controlKey}
|
|
</if>
|
|
<if test="controlValue != null and controlValue != ''">
|
|
and control_value = #{controlValue}
|
|
</if>
|
|
<if test="controlResult != null and controlResult != ''">
|
|
and control_result = #{controlResult}
|
|
</if>
|
|
<if test="controlContext != null and controlContext != ''">
|
|
and control_context = #{controlContext}
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
and create_by = #{createBy}
|
|
</if>
|
|
<if test="createTime != null and createTime != ''">
|
|
and create_time = #{createTime}
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
and update_by = #{updateBy}
|
|
</if>
|
|
<if test="updateTime != null and updateTime != ''">
|
|
and update_time = #{updateTime}
|
|
</if>
|
|
</where>
|
|
order by create_time desc
|
|
</select>
|
|
|
|
<!--统计总行数-->
|
|
<select id="count" resultType="java.lang.Long">
|
|
select count(1)
|
|
from psdc_control_log
|
|
<where>
|
|
<if test="controlLogId != null and controlLogId != ''">
|
|
and control_log_id = #{controlLogId}
|
|
</if>
|
|
<if test="deviceId != null and deviceId != ''">
|
|
and device_id = #{deviceId}
|
|
</if>
|
|
<if test="deviceName != null and deviceName != ''">
|
|
and device_name = #{deviceName}
|
|
</if>
|
|
<if test="deviceSn != null and deviceSn != ''">
|
|
and device_sn = #{deviceSn}
|
|
</if>
|
|
<if test="controlKey != null and controlKey != ''">
|
|
and control_key = #{controlKey}
|
|
</if>
|
|
<if test="controlValue != null and controlValue != ''">
|
|
and control_value = #{controlValue}
|
|
</if>
|
|
<if test="controlResult != null and controlResult != ''">
|
|
and control_result = #{controlResult}
|
|
</if>
|
|
<if test="controlContext != null and controlContext != ''">
|
|
and control_context = #{controlContext}
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
and create_by = #{createBy}
|
|
</if>
|
|
<if test="createTime != null and createTime != ''">
|
|
and create_time = #{createTime}
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
and update_by = #{updateBy}
|
|
</if>
|
|
<if test="updateTime != null and updateTime != ''">
|
|
and update_time = #{updateTime}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!--新增数据-->
|
|
<insert id="insert">
|
|
insert into psdc_control_log(device_id, device_name, device_sn, control_key, control_value, control_result,control_context,
|
|
create_by, create_time, update_by, update_time)
|
|
values (#{deviceId}, #{deviceName}, #{deviceSn}, #{controlKey}, #{controlValue}, #{controlResult},#{controlContext}, #{createBy},
|
|
sysdate(), #{updateBy}, #{updateTime})
|
|
</insert>
|
|
|
|
|
|
<!-- 更新数据 -->
|
|
<update id="update">
|
|
update psdc_control_log
|
|
<set>
|
|
<if test="controlLogId != null and controlLogId != ''">
|
|
control_log_id = #{controlLogId},
|
|
</if>
|
|
<if test="deviceId != null and deviceId != ''">
|
|
device_id = #{deviceId},
|
|
</if>
|
|
<if test="deviceName != null and deviceName != ''">
|
|
device_name = #{deviceName},
|
|
</if>
|
|
<if test="deviceSn != null and deviceSn != ''">
|
|
device_sn = #{deviceSn},
|
|
</if>
|
|
<if test="controlKey != null and controlKey != ''">
|
|
control_key = #{controlKey},
|
|
</if>
|
|
<if test="controlValue != null and controlValue != ''">
|
|
control_value = #{controlValue},
|
|
</if>
|
|
<if test="controlResult != null and controlResult != ''">
|
|
control_result = #{controlResult},
|
|
</if>
|
|
<if test="controlContext != null and controlContext != ''">
|
|
and control_context = #{controlContext}
|
|
</if>
|
|
<if test="createBy != null and createBy != ''">
|
|
create_by = #{createBy},
|
|
</if>
|
|
<if test="createTime != null and createTime != ''">
|
|
create_time = #{createTime},
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
update_by = #{updateBy},
|
|
</if>
|
|
<if test="updateTime != null and updateTime != ''">
|
|
update_time = #{updateTime},
|
|
</if>
|
|
</set>
|
|
where control_log_id = #{controlLogId}
|
|
</update>
|
|
|
|
<!--通过主键删除-->
|
|
<delete id="deleteById">
|
|
delete
|
|
from psdc_control_log
|
|
where control_log_id = #{controlLogId}
|
|
</delete>
|
|
</mapper> |