You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.6 KiB
52 lines
2.6 KiB
package com.mydreamjob.application;
|
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Pageable;
|
|
import org.springframework.data.jpa.repository.JpaRepository;
|
|
import org.springframework.stereotype.Repository;
|
|
|
|
import java.util.Optional;
|
|
import java.util.List;
|
|
|
|
@Repository
|
|
public interface ApplicationRepository extends JpaRepository<Application, Long> {
|
|
|
|
Optional<Application> findByJobIdAndStudentUserId(Long jobId, Long studentUserId);
|
|
|
|
List<Application> findByStudentUserIdOrderByCreatedAtDesc(Long studentUserId);
|
|
|
|
Page<Application> findByStudentUserIdOrderByCreatedAtDesc(Long studentUserId, Pageable pageable);
|
|
|
|
Page<Application> findByStudentUserIdAndStatusOrderByCreatedAtDesc(Long studentUserId, String status, Pageable pageable);
|
|
|
|
List<Application> findByJobIdOrderByCreatedAtDesc(Long jobId);
|
|
|
|
Page<Application> findByJobIdOrderByCreatedAtDesc(Long jobId, Pageable pageable);
|
|
|
|
Page<Application> findByJobIdAndStatusOrderByCreatedAtDesc(Long jobId, String status, Pageable pageable);
|
|
|
|
boolean existsByJobIdAndStudentUserId(Long jobId, Long studentUserId);
|
|
|
|
@org.springframework.data.jpa.repository.Query("select distinct a.jobId from Application a where a.studentUserId = :studentUserId")
|
|
java.util.List<Long> findDistinctJobIdsByStudentUserId(@org.springframework.data.repository.query.Param("studentUserId") Long studentUserId);
|
|
|
|
/**
|
|
* 同岗位竞争排名:判断学生是否存在某岗位的「有效投递」(状态不在排除集合内,
|
|
* 即非 WITHDRAWN/REJECTED)。与 {@link #findByJobIdAndStatusNotInOrderByCreatedAtAsc}
|
|
* 共用同一排除口径,避免"曾投递但已失效"误放行导致返回 200。
|
|
*/
|
|
boolean existsByJobIdAndStudentUserIdAndStatusNotIn(Long jobId, Long studentUserId,
|
|
java.util.Collection<String> statuses);
|
|
|
|
/**
|
|
* 同岗位 rank 用:取某岗位未排除(非 WITHDRAWN/REJECTED)的投递,按投递时间正序。
|
|
*/
|
|
List<Application> findByJobIdAndStatusNotInOrderByCreatedAtAsc(Long jobId, java.util.Collection<String> statuses);
|
|
|
|
/**
|
|
* V34 批量:一次取出多个岗位(page 内投递涉及的去重 jobId)未排除的候选人投递,
|
|
* 按投递时间正序;用于批量计算同岗位竞争力排名,避免按岗位循环查询造成 N+1。
|
|
*/
|
|
List<Application> findByJobIdInAndStatusNotInOrderByCreatedAtAsc(java.util.Collection<Long> jobIds,
|
|
java.util.Collection<String> statuses);
|
|
}
|
|
|