package com.centreproject.web.controller.kpi;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.centreproject.common.constant.KeyConstants;
import com.centreproject.common.core.domain.R;
import com.centreproject.system.domain.sync.kpi.DataSyncLog;
import com.centreproject.system.service.sync.IDataSyncLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

/**
 * @author lenovo
 */
@Tag(name = "kpi_sync_data_log")
@RestController
@RequestMapping("/kpi/syncDataLog")
public class KpiSyncDataLogController {
    @Resource
    private IDataSyncLogService dataSyncLogService;


    /**
     * 获取同步日志
     * @param dataSyncLog 查询条件
     * @param pageNum  页码 默认1
     * @param pageSize 条数 默认10
     * @return log
     */
    @GetMapping("/page")
    @Operation(summary = "page")
    public R<Page<DataSyncLog>> page(@ModelAttribute DataSyncLog dataSyncLog,
                                     @RequestParam(defaultValue = "1") int pageNum,
                                     @RequestParam(defaultValue = "10") int pageSize) {
        Page<DataSyncLog> result = dataSyncLogService.getDataSyncLogPage(dataSyncLog, pageNum, pageSize);
        return R.ok(result, KeyConstants.LOG);
    }
}
