|
|
@@ -13,18 +13,10 @@ import java.time.Instant;
|
|
|
@Repository
|
|
|
public interface QuickAskAuditLogRepository extends JpaRepository<QuickAskAuditLog, Long> {
|
|
|
|
|
|
- Page<QuickAskAuditLog> findAllByOrderByCreatedAtDesc(Pageable pageable);
|
|
|
-
|
|
|
- /**
|
|
|
- * 按操作类型筛选审计日志(action = CREATE / UPDATE / DELETE)
|
|
|
- * 前端 auditLog 接口可传 action 参数,后端自动使用此方法查询
|
|
|
- */
|
|
|
- Page<QuickAskAuditLog> findByActionOrderByCreatedAtDesc(String action, Pageable pageable);
|
|
|
-
|
|
|
@Query("SELECT a FROM QuickAskAuditLog a WHERE "
|
|
|
+ "(:action IS NULL OR a.action = :action) AND "
|
|
|
- + "(:startTime IS NULL OR a.createdAt >= :startTime) AND "
|
|
|
- + "(:endTime IS NULL OR a.createdAt < :endTime) "
|
|
|
+ + "(CAST(:startTime AS java.time.Instant) IS NULL OR a.createdAt >= :startTime) AND "
|
|
|
+ + "(CAST(:endTime AS java.time.Instant) IS NULL OR a.createdAt < :endTime) "
|
|
|
+ "ORDER BY a.createdAt DESC")
|
|
|
Page<QuickAskAuditLog> findByFilters(
|
|
|
@Param("action") String action,
|