package com.lesingle.creation.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lesingle.creation.entity.SysLog;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 系统日志 Mapper 接口
 */
@Mapper
public interface SysLogMapper extends BaseMapper<SysLog> {

    /**
     * 获取日志统计数据
     */
    Map<String, Object> getStatistics(@Param("days") Integer days);

    /**
     * 获取按操作类型统计的日志
     */
    List<Map<String, Object>> getActionStats(@Param("days") Integer days);

    /**
     * 获取按天统计的日志
     */
    List<Map<String, Object>> getDailyStats(@Param("days") Integer days);

    /**
     * 清理过期日志
     */
    int deleteOldLogs(@Param("cutoffDate") LocalDateTime cutoffDate);
}
