package com.taais.system.controller.system;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.taais.common.core.core.domain.CommonResult;
import com.taais.common.core.core.page.PageResult;
import com.taais.common.web.core.BaseController;
import com.taais.system.domain.bo.ImportExportBo;
import com.taais.system.domain.vo.ImportExportVo;
import com.taais.system.service.IImportExportService;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
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));
    }
}
