package com.crm.manager.dao.repository;

import com.crm.rely.backend.core.pojo.table.CustomAllocationRosterScheduledTable;
import com.crm.rely.backend.dao.repository.BaseRepository;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.stereotype.Repository;

import javax.persistence.LockModeType;
import java.sql.Date;
import java.util.List;

/**
 * @author: houn
 */
@Repository
public interface CustomAllocationRosterScheduledRepository extends BaseRepository<CustomAllocationRosterScheduledTable> {

    CustomAllocationRosterScheduledTable getFirstById(Long id);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    List<CustomAllocationRosterScheduledTable> findAllByIdIn(List<Long> ids);

    @Lock(LockModeType.PESSIMISTIC_WRITE)
    CustomAllocationRosterScheduledTable findFirstById(Long id);

    List<CustomAllocationRosterScheduledTable> findAllByWeekdayAndLastTime(Integer weekday, Date lastTime);

    List<CustomAllocationRosterScheduledTable> findAllByWeekdayAndLastTimeIsNull(Integer weekday);
}
