package com.jwipc.sys.controller;

import com.jwipc.api.dto.ApiResult;
import com.jwipc.sys.logic.FileApiLogic;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author shenyang.ou
 * @date 2025/3/3 19:42
 * @desc
 */
@RestController
@RequestMapping( "/file/api")
@RequiredArgsConstructor
public class FileApiController {
    private final FileApiLogic fileApiLogic;
    @PostMapping("/upload/file")
    public ApiResult uploadFile(@RequestPart("file") MultipartFile file) {
        return fileApiLogic.uploadFile(file);
    }

    @PostMapping("/upload/more/file")
    public ApiResult uploadFiles(@RequestPart("files") MultipartFile[] files) {
        return fileApiLogic.uploadFiles(files);
    }
}
