package com.yihu.jw.base.dao.course;

import com.yihu.jw.entity.care.course.RecruitStudentsRecordDO;
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 org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: yeshijie
 * @Date: 2021/5/12
 * @Description:
 */
public interface RecruitStudentsRecordDao extends PagingAndSortingRepository<RecruitStudentsRecordDO, String>,
        JpaSpecificationExecutor<RecruitStudentsRecordDO> {

    List<RecruitStudentsRecordDO> findByRecruitStudentsIdAndStatus(String recruitStudentsId,String status);

    @Transactional
    @Modifying
    @Query("update RecruitStudentsRecordDO a set a.status = 8 where a.id = ?1")
    int updateStatus(String id);
}
