
package com.tmerclub.cloud.biz.controller;

import com.tmerclub.cloud.biz.service.AttachFileService;
import com.tmerclub.cloud.biz.vo.PreSignUrlVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author tmerclub
 * @date 2020/9/10
 */
@SuppressWarnings({"CommentedOutCode", "AlibabaRemoveCommentedCode"})
@RequestMapping("/ua/oss")
@RestController
@Tag(name = "文件管理")
public class OssController {

    @Autowired
    private AttachFileService attachFileService;

    @GetMapping("/getBatchPreSignUrl")
    @Operation(summary = "批量获取预签名url(s3协议)")
    @Parameter(name = "fileNames", description = "文件名集合")
    public ServerResponseEntity<List<PreSignUrlVO>> getBatchPreSignUrl(@RequestParam List<String> fileNames) {
        List<PreSignUrlVO> preSignUrlVOList = attachFileService.getBatchPreSignUrl(fileNames);
        return ServerResponseEntity.success(preSignUrlVOList);
    }
}
