package com.fuyuanshen.equipment.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
import com.fuyuanshen.equipment.domain.DeviceFenceAccessRecord;
import com.fuyuanshen.equipment.domain.bo.DeviceFenceAccessRecordBo;
import com.fuyuanshen.equipment.domain.vo.DeviceFenceAccessRecordVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 围栏进出记录Mapper接口
 *
 * @author Lion Li
 * @date 2025-09-11
 */
public interface DeviceFenceAccessRecordMapper extends BaseMapperPlus<DeviceFenceAccessRecord, DeviceFenceAccessRecordVo> {

    /**
     * 分页查询围栏进出记录列表（包含围栏名称和设备名称）
     *
     * @param page    分页参数
     * @param wrapper 查询条件
     * @return 围栏进出记录分页列表
     */
    Page<DeviceFenceAccessRecordVo> selectVoPageWithFenceAndDeviceName(Page<DeviceFenceAccessRecord> page, @Param(Constants.WRAPPER) Wrapper<DeviceFenceAccessRecord> wrapper);

    List<DeviceFenceAccessRecordVo> selectVoPageWithFenceAndDeviceName(@Param(Constants.WRAPPER) Wrapper<DeviceFenceAccessRecord> wrapper, @Param("fenceName") String fenceName);

    /**
     * 分页查询围栏进出记录列表（纯XML形式）
     *
     * @param page 分页参数
     * @param bo   查询条件
     * @return 围栏进出记录分页列表
     */
    Page<DeviceFenceAccessRecordVo> selectVoPageByXml(Page<DeviceFenceAccessRecord> page, @Param("bo") DeviceFenceAccessRecordBo bo);

    List<DeviceFenceAccessRecordVo> selectVoPageByXml(@Param("bo") DeviceFenceAccessRecordBo bo);


    /**
     * 查询设备最新的围栏记录
     *
     * @param deviceId 设备ID
     * @return 围栏记录
     */
    DeviceFenceAccessRecordVo selectLatestRecordByDeviceId(String deviceId);


}
