package com.skr.mdm.api.system.controller;

import com.skr.mdm.api.system.service.MdmImportHistoryService;
import com.skr.mdm.dto.LoginAdminDTO;
import com.skr.mdm.result.ResponseResult;
import com.skr.mdm.bean.qo.system.MdmImportHistoryPageQO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;

/**
 * @author nfq
 * @date 2023-02-22 9:43
 */
@Validated
@RestController
@RequestMapping("import/history")
@Api(tags = "导入历史")
public class MdmImportHistoryController {

    @Autowired
    private MdmImportHistoryService importHistoryService;

    @ApiOperation("导入历史列表")
    @PostMapping("list")
    public ResponseResult list(@RequestBody @Valid MdmImportHistoryPageQO importHistoryPageQO,
                               @ApiIgnore Authentication authentication) {
        LoginAdminDTO loginAdminDTO = (LoginAdminDTO) authentication.getPrincipal();
        return importHistoryService.listImportHistory(importHistoryPageQO, loginAdminDTO);
    }
}
