Files
fys-Multi-tenant/fys-modules/fys-equipment/src/main/resources/mapper/equipment/DeviceLogMapper.xml
2025-08-29 16:49:16 +08:00

44 lines
1.6 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.fuyuanshen.equipment.mapper.DeviceLogMapper">
<select id="getInstructionRecord" resultType="com.fuyuanshen.equipment.domain.vo.InstructionRecordVo">
SELECT
a.id,
a.device_name AS deviceName,
c.type_name deviceType,
a.device_action AS deviceAction,
a.content,
a.create_time AS createTime
FROM
device_log a left join device b on a.device_id = b.id
left join device_type c on b.device_type = c.id
WHERE 1 = 1
<if test="bo.deviceType != null">
AND c.id = #{bo.deviceType}
</if>
<if test="bo.deviceName != null and bo.deviceName != ''">
AND a.device_name like concat('%',#{bo.deviceName},'%')
</if>
<if test="bo.deviceMac != null and bo.deviceMac != ''">
AND b.device_mac = #{bo.deviceMac}
</if>
<if test="bo.deviceImei != null and bo.deviceImei != ''">
AND b.device_imei = #{bo.deviceImei}
</if>
<if test="bo.startTime != null and bo.startTime != ''">
AND a.create_time <![CDATA[>=]]> #{bo.startTime}
</if>
<if test="bo.endTime != null and bo.endTime != ''">
AND a.create_time <![CDATA[<=]]> #{bo.endTime}
</if>
<if test="bo.groupId != null">
and b.group_id = #{bo.groupId}
</if>
ORDER BY
a.create_time DESC
</select>
</mapper>