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.Property;

/**
 * @author weiwenhai
 * @describle 课程属性repo
 * @date 2017.11.6
 */
public interface PropertyRepo extends JpaRepository<Property, Long>, QueryByExampleExecutor<Property>, JpaSpecificationExecutor<Property> {

    //查询所有节点
    List<Property> findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(Long orgId, Long coursePropertyId, Long parentId);

    //查询子节点
    List<Property> findByParentIdOrderByNumber(Long parentId);

    //根据课程属性id，一级id，属性名称查询
    Property findByOrgIdAndCoursePropertyIdAndParentIdAndName(Long orgId, Long coursePropertyId, Long parentId, String name);

}
