package com.cirle.scientific.dao;/*
 *24901
 *2022/11/10
 *14:14
 */

import com.cirle.scientific.po.QkjPhotoWall;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

/**
 * @author 24901
 */
public interface QkjPhotoWallDao extends PagingAndSortingRepository<QkjPhotoWall, Long>, JpaSpecificationExecutor<QkjPhotoWall> {

    @Query(value = "select * from qkj_photowall where type = ?1 and obj_id = ?2 and state = 0 limit ?3 ,?4",nativeQuery = true)
    List<QkjPhotoWall> findAllByTypeAndObjId(Integer type, Integer id, Integer start, Integer size);

    @Query(value = "select count(*) from qkj_photowall where type = ?1 and obj_id = ?2 and state = 0 ",nativeQuery = true)
    Integer findAllByTypeAndObjId(Integer type, Integer id);

}
