package com.ssj.dao.sys.parent.dao;

import com.ssj.bean.sys.parent.domain.SSJPeiyouBook;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;


@Repository
public interface SSJPeiyouBookDao extends JpaRepository<SSJPeiyouBook, String> {

    @Query(nativeQuery = true,value = "select  book_name from ssj_peiyou_book s where s.course_name = ?1 and s.grade = ?2 GROUP BY book_name ")
    List<String> findGroupByBookName(String courseName, String grade);

    Page<SSJPeiyouBook> findAll(Specification<SSJPeiyouBook> specification, Pageable page);

    List<SSJPeiyouBook> findByGradeAndCourseNameAndBookNameAndUnitAndSecondUnit(String grade, String courseName, String bookName, String unit, String secondUnit);

    List<SSJPeiyouBook> findByGradeAndCourseNameAndUnitAndSecondUnit(String grade, String courseName, String unit, String secondUnit);
}
