package cn.com.liandisys.ycjt.ggcx.admin.dao.cms;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import cn.com.liandisys.ycjt.ggcx.admin.model.cms.Category;

/**
 * 文章栏目实体的DAO interface.
 * @author jiangchao
 * @version 2016-11-29
 */
public interface CategoryDao extends JpaRepository<Category, String>, JpaSpecificationExecutor<Category> {

	@Query(value="select c from Category c where c.parent.id =?1 order by sort asc")
	List<Category> findByParentId(String id);

	@Query(value="select c from Category c where c.parent.id =?1 and c.module='article' order by sort asc")
	List<Category> findByParentIdByArticle(String id);
}
