package com.yuchen.saas.park.service.mapper.door.card;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yuchen.saas.park.api.entity.door.card.DoorAccessControlCardBiometrics;
import org.apache.ibatis.annotations.Mapper;

import javax.annotation.Nullable;
import javax.validation.constraints.Positive;
import java.util.List;
import java.util.Set;

@Mapper
public interface DoorAccessControlCardBiometricsRepository extends BaseMapper<DoorAccessControlCardBiometrics> {
    @Nullable
    default DoorAccessControlCardBiometrics getByDoorAccessControlCardId(@Positive long doorAccessControlCardId) {
        return this.selectOne(Wrappers.<DoorAccessControlCardBiometrics>lambdaQuery().eq(DoorAccessControlCardBiometrics::getDoorAccessControlCardId, doorAccessControlCardId));
    }

    @Nullable
    default List<DoorAccessControlCardBiometrics> listByDoorAccessControlCardIds(Set<@Positive Long> doorAccessControlCardIds) {
        return this.selectList(Wrappers.<DoorAccessControlCardBiometrics>lambdaQuery().in(DoorAccessControlCardBiometrics::getDoorAccessControlCardId, doorAccessControlCardIds));
    }

    default void deleteByDoorAccessControlCardId(@Positive long doorAccessControlCardId) {
        this.delete(Wrappers.<DoorAccessControlCardBiometrics>lambdaQuery().eq(DoorAccessControlCardBiometrics::getDoorAccessControlCardId, doorAccessControlCardId));
    }

    default void deleteByDoorAccessControlCardIds(Set<@Positive Long> doorAccessControlCardIds) {
        this.delete(Wrappers.<DoorAccessControlCardBiometrics>lambdaQuery().in(DoorAccessControlCardBiometrics::getDoorAccessControlCardId, doorAccessControlCardIds));
    }
}
