package com.softwarebr.nunu.dao.res;

import com.brframework.commondb.core.CommonRepository;
import com.softwarebr.nunu.entity.res.PropertyApply;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @date 2020-02-24 12:19:06
 * @author lilin
 */

@Repository
public interface PropertyApplyDao extends CommonRepository<Long, PropertyApply> {


    /**
     * 查询指定资源申请审核通过数据
     * @param resourceType 资源类型{@link PropertyApply}
     * @param targetId 资源对象ID
     * @param proposer 申请人
     * @param verify 审核状态
     * @return
     */
    PropertyApply findTopByResourceTypeAndTargetIdAndProposerAndVerify(Integer resourceType, Long targetId, Long proposer, Integer verify);

    /**
     * 查询指定资源并根据审核状态筛选数据
     * @param resourceType 资源类型 {@link PropertyApply}
     * @param targetId 资源对象id
     * @param verify 审核状态
     * @return
     */
    Long countByResourceTypeAndTargetIdAndVerify(Integer resourceType, Long targetId, Integer verify);

    /**
     * 查询指定资源类型待审核数据
     * @param resourceType  资源类型 {@link PropertyApply}
     * @param verify 审核状态
     * @return
     */
    List<PropertyApply> findByResourceTypeAndVerify(Integer resourceType, Integer verify);

}