package cn.com.qmth.examcloud.core.questions.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.query.QueryByExampleExecutor;

import cn.com.qmth.examcloud.core.questions.dao.entity.CourseProperty;

/**
 * @author weiwenhai
 * @describle 课程属性repo
 * @date 2017.11.2
 */
public interface CoursePropertyRepo extends JpaRepository<CourseProperty, Long>, QueryByExampleExecutor<CourseProperty>, JpaSpecificationExecutor<CourseProperty> {

    //查询所有课程属性
    List<CourseProperty> findByOrgId(Long orgId);

    //根据属性名查询
    CourseProperty findByNameAndOrgId(String name, Long orgId);

    //根据课程id查询
    List<CourseProperty> findByCourseId(Long courseId);

    List<CourseProperty> findByCourseCode(String code);

    //根据课程代码查询已开启的课程属性
    List<CourseProperty> findByCourseCodeAndEnable(String code, Boolean enable);

    //根据课程id查询已经开启的课程属性
    List<CourseProperty> findByCourseIdAndEnable(Long courseId, Boolean enable);

    //根据id集合查询
    List<CourseProperty> findByIdIn(List<Long> ids);
}
