package com.mosquito.project.permission;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 权限审计日志Repository
 */
@Repository
public interface PermissionAuditRepository extends JpaRepository<SysPermissionAudit, Long> {

    /**
     * 根据目标类型和目标ID查询审计记录
     */
    List<SysPermissionAudit> findByTargetTypeAndTargetIdOrderByCreatedAtDesc(String targetType, Long targetId);

    /**
     * 根据操作人ID查询审计记录
     */
    List<SysPermissionAudit> findByOperatorIdOrderByCreatedAtDesc(Long operatorId);

    /**
     * 根据操作类型查询审计记录
     */
    List<SysPermissionAudit> findByOperationTypeOrderByCreatedAtDesc(String operationType);
}
