package com.crm.web.dao.repository;

import com.crm.rely.backend.dao.repository.BaseRepository;
import com.crm.rely.backend.model.pojo.table.CustomVideoRecordTable;
import com.crm.rely.backend.model.pojo.table.WebVideoTable;
import org.springframework.data.jpa.repository.Lock;
import org.springframework.stereotype.Repository;

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

@Repository
public interface CustomVideoRecordRepository extends BaseRepository<CustomVideoRecordTable> {

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

    CustomVideoRecordTable getFirstById(Long id);

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

    List<CustomVideoRecordTable> getAllByIdNotIn(List<Long> ids);

    boolean existsByCustomIdAndVideoId(Long customId,Long videoId);


    @Lock(LockModeType.PESSIMISTIC_WRITE)
    List<CustomVideoRecordTable> findAllByCustomId(Long customId);
}
