package com.fuyuanshen.equipment.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuyuanshen.equipment.domain.Device;
import com.fuyuanshen.equipment.domain.query.DeviceQueryCriteria;
import com.fuyuanshen.equipment.domain.vo.AppDeviceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description:
 * @Author: WY
 * @Date: 2025/5/16
 **/
@Mapper
public interface DeviceMapper extends BaseMapper<Device> {

    /**
     * 分页查询设备
     *
     * @param criteria
     * @param page
     * @return
     */
    IPage<Device> findAll(@Param("criteria") DeviceQueryCriteria criteria, Page<Device> page);

    List<Device> findAll(@Param("criteria") DeviceQueryCriteria criteria);

    List<Device> findAllDevices(@Param("criteria") DeviceQueryCriteria criteria);

    /**
     * 根据条件查询
     *
     * @param criteria
     * @return
     */
    List<Device> findDevices(@Param("criteria") DeviceQueryCriteria criteria);

    /**
     * 查询APP绑定设备列表
     *
     * @param criteria
     * @return
     */
    Page<AppDeviceVo> queryAppBindDeviceList(Page<AppDeviceVo> page, @Param("criteria") DeviceQueryCriteria criteria);


    Page<AppDeviceVo> queryAppDeviceList(Page<AppDeviceVo> page, @Param("criteria") DeviceQueryCriteria criteria);

    /**
     * 获取分配设备的客户
     *
     * @param customerId
     * @return
     */
    Device getAssignCustomer(Long customerId);

    /**
     * 获取设备链
     *
     * @param originalDeviceId
     * @return
     */
    List<Device> findByOriginalDeviceId(Long originalDeviceId);
}
