package com.yida.data.attendance.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yida.data.attendance.dto.DevicePage;
import com.yida.data.attendance.vo.DeviceVO;
import com.yida.data.common.core.entity.attendance.EduAttendanceDevice;

import java.util.List;
import java.util.Set;

import org.apache.ibatis.annotations.Param;

public interface EduAttendanceDeviceMapper extends BaseMapper<EduAttendanceDevice> {

    DevicePage<DeviceVO> listDevicePage(@Param("page") Page page,
                                        @Param("schoolIds") List<Long> schoolIds,
                                        @Param("number") String number,
                                        @Param("scope") Integer scope,
                                        @Param("type") Integer type,
                                        @Param("state") Integer state);

    void updateDevice(@Param("operation") Integer operation,
                      @Param("type") String type,
                      @Param("aliveDeviceSn") Set<String> aliveDeviceSn);

    /**
     * 根据学校id和状态查询考勤设备数量统计
     *
     * @param schoolIds 学校id集合
     * @param state     考勤设备状态
     * @return java.lang.Long
     * @author ZYJ
     * @date 2021/10/9 13:36
     */
    Long findDeviceNumber(@Param("schoolIds") List<Long> schoolIds, @Param("state") Integer state);

    /**
     * 判断设备编号是否重复
     *
     * @param device 设备信息
     * @return com.yida.data.common.core.entity.attendance.EduAttendanceDevice
     * @author ZYJ
     * @date 2023/10/23 15:02
     */
    EduAttendanceDevice checkSn(@Param("device") EduAttendanceDevice device);
}
