package com.ga.common.system;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface SystemLogMapper {

    int insertLoginLog(@Param("userId") Long userId,
                       @Param("loginId") String loginId,
                       @Param("loginType") String loginType,
                       @Param("failReason") String failReason,
                       @Param("ipAddress") String ipAddress,
                       @Param("userAgent") String userAgent);

    int insertApiAccessLog(@Param("userId") Long userId,
                           @Param("method") String method,
                           @Param("url") String url,
                           @Param("requestParam") String requestParam,
                           @Param("responseCode") String responseCode,
                           @Param("responseTime") Integer responseTime,
                           @Param("ipAddress") String ipAddress,
                           @Param("errorMessage") String errorMessage);

    int insertDataChangeLog(@Param("userId") Long userId,
                            @Param("menuCode") String menuCode,
                            @Param("tableName") String tableName,
                            @Param("recordId") String recordId,
                            @Param("actionType") String actionType,
                            @Param("beforeJson") String beforeJson,
                            @Param("afterJson") String afterJson,
                            @Param("changedKeys") String changedKeys);

    List<Map<String, Object>> selectLoginLogs(@Param("param") Map<String, Object> param);
    List<Map<String, Object>> selectApiAccessLogs(@Param("param") Map<String, Object> param);
    List<Map<String, Object>> selectDataChangeLogs(@Param("param") Map<String, Object> param);
}
