<?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="org.jeecg.pm.mapper.PmAccessControlDeviceRecordMapper">

    <select id="recordPage" resultType="org.jeecg.pm.entity.PmAccessControlDeviceRecordVo">
        select
        dr.id,
        dr.pm_access_control_device_id,
        dr.picture_url,
        dr.compellation,
        dr.classify,
        dr.create_time,
        dr.modify_time,
        cd.district_name,
        cd.code,
        cd.type,
        cd.name,
        cd.ip,
        cd.place
        from pm_access_control_device_record dr
        left join pm_access_control_device cd on cd.id = dr.pm_access_control_device_id
        where 1=1
        <if test="pmAccessControlDeviceRecordDto.name != null and pmAccessControlDeviceRecordDto.name !=''">
            AND INSTR(cd.`name`, #{pmAccessControlDeviceRecordDto.name}) > 0
        </if>
        <if test="pmAccessControlDeviceRecordDto.type != null and pmAccessControlDeviceRecordDto.type !=''">
            AND cd.`type`=#{pmAccessControlDeviceRecordDto.type}
        </if>
    </select>

    <select id="recordPages">
        select
        dr.id,
        dr.pm_access_control_device_id,
        dr.picture_url,
        dr.compellation,
        dr.classify,
        dr.create_time,
        dr.modify_time,
        cd.district_name,
        cd.code,
        cd.type,
        cd.name,
        cd.ip,
        cd.place
        from pm_access_control_device_record dr
        left join pm_access_control_device cd on cd.id = dr.pm_access_control_device_id
        where 1=1
        <if test="pmAccessControlDeviceRecordDto.name != null and pmAccessControlDeviceRecordDto.name !=''">
            AND INSTR(cd.`name`, #{pmAccessControlDeviceRecordDto.name}) > 0
        </if>
        <if test="pmAccessControlDeviceRecordDto.type != null and pmAccessControlDeviceRecordDto.type !=''">
            AND cd.`type`=#{pmAccessControlDeviceRecordDto.type}
        </if>
    </select>
</mapper>