package com.fjhx.controller;

import com.fjhx.entity.FileInfo;
import com.fjhx.service.FileInfoService;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 文件 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-07-07
 */
@RestController
public class FileInfoController {

    @Autowired
    private FileInfoService fileInfoService;

    @PostMapping("/uploadFile")
    public R uploadFile(@RequestParam("file") MultipartFile file) {
        FileInfo result = fileInfoService.uploadFile(file);
        return R.success(result);
    }

    @PostMapping("/getFileList")
    public R getFileList(@RequestBody Map<String, String> condition) {
        List<FileInfo> result = fileInfoService.getFileList(condition);
        return R.success(result);
    }

}

