package com.yaoai.domain.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yaoai.domain.entity.TenantModelDefault;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;
import java.util.Optional;

@Mapper
public interface TenantModelDefaultMapper extends BaseMapper<TenantModelDefault> {

    default List<TenantModelDefault> findByTenant(Long tenantId) {
        return selectList(Wrappers.<TenantModelDefault>lambdaQuery()
                .eq(TenantModelDefault::getTenantId, tenantId));
    }

    default Optional<TenantModelDefault> findByCapability(Long tenantId, String capability) {
        return Optional.ofNullable(selectOne(Wrappers.<TenantModelDefault>lambdaQuery()
                .eq(TenantModelDefault::getTenantId, tenantId)
                .eq(TenantModelDefault::getCapability, capability)));
    }
}
