package cn.teammodel.dao;
import cn.teammodel.model.entity.appraise.Appraise;
import cn.teammodel.model.entity.appraise.AppraiseTreeNode;
import com.azure.cosmos.models.PartitionKey;
import com.azure.spring.data.cosmos.repository.CosmosRepository;
import com.azure.spring.data.cosmos.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @author winter
* @create 2023-11-20 14:39
* Page findByLastname(String lastname, Pageable pageable);
* Slice findByLastname(String lastname, Pageable pageable);
* Window findTop10ByLastname(String lastname, ScrollPosition position, Sort sort);
* List findByLastname(String lastname, Sort sort);
* List findByLastname(String lastname, Sort sort, Limit limit);
* List findByLastname(String lastname, Pageable pageable);
*/
@Repository
public interface AppraiseRepository extends CosmosRepository {
Appraise findBySchoolId(String schoolId, PartitionKey partitionKey);
Appraise findAppraiseBySchoolIdAndPeriodIdAndCode(String schoolId, String periodId, String code);
@Query("SELECT value n FROM School AS s join n in s.nodes where s.schoolId = @schoolId and s.periodId = @periodId and s.code = @code and n.id = @nodeId")
List findNodeById(@Param("schoolId") String schoolId, @Param("periodId") String periodId, @Param("code") String code, @Param("nodeId") String nodeId);
}