You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
IESExtension/src/main/java/cn/teammodel/dao/AppraiseRepository.java

41 lines
2.0 KiB

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 <br/>
* Page<User> findByLastname(String lastname, Pageable pageable); <br/>
* Slice<User> findByLastname(String lastname, Pageable pageable);<br/>
* Window<User> findTop10ByLastname(String lastname, ScrollPosition position, Sort sort);<br/>
* List<User> findByLastname(String lastname, Sort sort);<br/>
* List<User> findByLastname(String lastname, Sort sort, Limit limit);<br/>
* List<User> findByLastname(String lastname, Pageable pageable);<br/>
*/
@Repository
public interface AppraiseRepository extends CosmosRepository<Appraise, String> {
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<Appraise> findTemplateTree();
@Query("SELECT value n FROM School AS s join n in s.nodes where s.code = @code and n.id = @nodeId")
List<AppraiseTreeNode> 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<AppraiseTreeNode> findAllByCodeAndIdIn(String code, Set<String> ids);
@Query("SELECT c.id, c.achievementRules FROM School AS c where c.code = 'Appraise' and c.schoolId = @schoolId and c.periodId = @periodId")
List<Appraise> findRulesById(String schoolId, String periodId);
}