package org.eco.system.controller.system;

import cn.dev33.satoken.annotation.SaCheckPermission;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.eco.common.core.core.domain.CommonResult;
import org.eco.common.core.core.page.PageResult;
import org.eco.common.web.core.BaseController;
import org.eco.system.domain.bo.ImportExportBo;
import org.eco.system.domain.vo.ImportExportVo;
import org.eco.system.service.IImportExportService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 导入导出日志Controller
 *
 * @author wgk
 * @date 2024-06-24
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/system/importExport")
public class ImportExportController extends BaseController {
    @Resource
    private IImportExportService importExportService;

    /**
     * 查询导入导出日志列表
     */
    @SaCheckPermission("system:importExport:list")
    @GetMapping("/list")
    public CommonResult<PageResult<ImportExportVo>> list(ImportExportBo importExportBo) {
        return CommonResult.success(importExportService.selectPage(importExportBo));
    }

    /**
     * 获取导入导出日志详细信息
     */
    @SaCheckPermission("system:importExport:query")
    @GetMapping(value = "/{id}")
    public CommonResult<ImportExportVo> getInfo(@PathVariable Long id) {
        return CommonResult.success(importExportService.selectById(id));
    }
}
