lrj
2 天以前 c61d4fe27c97d2ecc907756aa571a4ef14a7b9b6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package com.rongyichuang.rating.repository;
 
import com.rongyichuang.rating.entity.RatingScheme;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
 
/**
 * 评分模板数据访问层
 */
@Repository
public interface RatingSchemeRepository extends JpaRepository<RatingScheme, Long> {
 
    /**
     * 根据名称模糊查询评分模板
     */
    @Query("SELECT rs FROM RatingScheme rs WHERE rs.name LIKE %:name%")
    Page<RatingScheme> findByNameContaining(@Param("name") String name, Pageable pageable);
 
    /**
     * 检查模板是否被比赛使用(暂时返回false,等Activity实体创建后再实现)
     */
    default boolean isUsedByActivity(Long schemeId) {
        // TODO: 等Activity实体创建后实现此方法
        return false;
    }
}