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;
import java.util.Set;
/**
* @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 * FROM School AS s where s.code = 'Appraise' and s.schoolId = 'template'")
List findTemplateTree();
@Query("SELECT value n FROM School AS s join n in s.nodes where s.code = @code and n.id = @nodeId")
List findNodeById(@Param("code") String code, @Param("nodeId") String nodeId);
@Query("select n.id, n.name from School as c join n in c.nodes where c.code = @code and n.id in (@ids)")
List findAllByCodeAndIdIn(String code, Set ids);
}