package cn.teammodel.repository;

import cn.teammodel.model.entity.school.ClassInfo;
import com.azure.spring.data.cosmos.repository.CosmosRepository;
import com.azure.spring.data.cosmos.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;

/**
 * @author winter
 * @create 2023-12-01 16:37
 */
@Repository
public interface ClassRepository extends CosmosRepository<ClassInfo, String> {
    ClassInfo findClassByIdAndCode(String targetId, String code);

    @Query("select c.id, c.name from School as c where c.code = @code and c.id in (@ids)")
    List<ClassInfo> findAllByCodeAndIdIn(String code, Collection<String> ids);
    @Query("select c.id, c.name,c.year,c.periodId from School as c where c.periodId = @periodId and c.pk = 'Class' and c.code = @code")
    List<ClassInfo> findClassBySchoolIdAndPeriodId(String periodId,String code);
}
