物管理后端
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.

55 lines
2.3 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.thing.control.mapper.IotDeviceControlLogMapper">
<resultMap type="com.thing.control.entity.IotDeviceControlLogEntity" id="iotDeviceControlLogMap">
<result property="id" column="id"/>
<result property="controlId" column="control_id"/>
<result property="inMsg" column="in_msg"/>
<result property="outMsg" column="out_msg"/>
<result property="errorMsg" column="error_msg"/>
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result property="updater" column="updater"/>
<result property="updateDate" column="update_date"/>
</resultMap>
<select id="getList" resultType="com.thing.control.dto.IotDeviceControlLogPage">
SELECT
idcl.ID,
idcl.control_id,
idc.name as control_name,
idc.extend_id,
idc.relation_id,
itt.code as thing_code,
itt.name as thing_name,
idr.code as attr_code,
idr.name as attr_name,
idcl.in_msg,
idcl.out_msg,
idcl.error_msg,
idcl.update_date,
su.real_name as creator
FROM
iot_device_control_log idcl
INNER JOIN iot_device_control idc ON idcl.control_id = idc.id
LEFT JOIN iot_thing_entity itt ON idc.thing_id = itt.id
INNER JOIN iot_thing_dict_relation idr ON itt.ID = idr.entity_id and idr.id= idc.attr_id
LEFT JOIN sys_user su ON idcl.creator = su.id
<where>
<if test="name != null and name.trim() != ''">
and idc.name like #{name}
</if>
<if test="device != null and device.trim() != ''">
and (itt.code like #{device} or itt.name like #{device})
</if>
<if test="attr != null and attr.trim() != ''">
and (idr.code like #{attr} or idr.name like #{attr})
</if>
<if test="extendId != null">
and idc.extend_id = #{extendId}
</if>
</where>
</select>
</mapper>