场景模型测试工具
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.
scmy/psdc-business/src/main/resources/mapper/business/PsdcControlLogMapper.xml

171 lines
7.3 KiB

2 years ago
<?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="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,create_by,create_time,update_by,update_time
from psdc_control_log
where control_log_id = #{controlLogId}
</select>
<!--分页查询指定行数据-->
<select id="queryAllByLimit" resultMap="PsdcControlLogMap">
select
control_log_id,device_id,device_name,device_sn,control_key,control_value,control_result,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="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>
limit #{pageable.offset}, #{pageable.pageSize}
</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="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(control_log_id,device_id,device_name,device_sn,control_key,control_value,control_result,create_by,create_time,update_by,update_time)
values (#{controlLogId},#{deviceId},#{deviceName},#{deviceSn},#{controlKey},#{controlValue},#{controlResult},#{createBy},#{createTime},#{updateBy},#{updateTime})
</insert>
<!-- 批量新增数据 -->
<insert id="insertBatch" >
insert into psdc_control_log(control_log_id,device_id,device_name,device_sn,control_key,control_value,control_result,create_by,create_time,update_by,update_time)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.controlLogId},#{entity.deviceId},#{entity.deviceName},#{entity.deviceSn},#{entity.controlKey},#{entity.controlValue},#{entity.controlResult},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime})
</foreach>
</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="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>