package com.crunii.micro.domain.repo.main;

import com.crunii.micro.domain.common.BaseRepo;
import com.crunii.micro.domain.entity.main.YcqObsFile;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author qiaolin
 * @version 1.0
 * @date 2023/6/3 11:28
 */
@Repository
public interface YcqObsFileRepo extends BaseRepo<YcqObsFile, Long> {
    /**
     * 通过id查询文件
     *
     * @param id
     * @param state
     * @return
     */
    //List<YcqObsFile> findByIdInAndState(List<Long> id, Integer state);

    YcqObsFile findByIdAndState(Long id, Integer state);

    List<YcqObsFile> findAllByState(Integer state);

    List<YcqObsFile> findByServiceCodeAndServiceIdAndState(String serviceCode, Long serviceId, Integer state);

    @Query(value = "select * from YCQ_OBS_FILE where state=1 and is_pic=1 and compress_status is null limit 10", nativeQuery = true)
    List<YcqObsFile> findAllByStateAndIsPicLimitTen();

    YcqObsFile findByObjectKeyAndIsPicAndState(String fileKey, int i, int i1);
}
