package com.yihu.editor.dao;

import com.yihu.editor.entity.SystemDictItem;
import com.yihu.editor.entity.YdfHealthEduArticle;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

/**
 * Created by Administrator on 2017/6/11 0011.
 */
public interface ArticleDao extends PagingAndSortingRepository<YdfHealthEduArticle, Long>, JpaSpecificationExecutor<YdfHealthEduArticle>{

    @Query("select a from SystemDictItem a where a.dict =?1 order by a.sort")
    List<SystemDictItem> findByDict(String dict);

    @Modifying
    @Query("update YdfHealthEduArticle a set a.status = -1 where a.id = ?1 ")
    void delete(String id);
}
