package com.qmth.teachcloud.common.api.api;

import com.qmth.boot.api.constant.ApiConstant;
import com.qmth.teachcloud.common.entity.BasicAttachment;
import com.qmth.teachcloud.common.service.BasicAttachmentService;
import com.qmth.teachcloud.common.util.Result;
import com.qmth.teachcloud.common.util.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 所有附件记录表 前端控制器
 * </p>
 *
 * @author xf
 * @since 2021-03-23
 */
@Api(tags = "文件上传Controller")
@RestController
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + "/${prefix.url.common}/file")
public class BasicAttachmentController {

    @Autowired
    private BasicAttachmentService basicAttachmentService;

    /**
     * 文件查询
     * @return
     */
    @ApiOperation(value = "文件查询")
    @RequestMapping(value = "/get_one", method = RequestMethod.POST)
    public Result getOne(@RequestParam(required = true) Long id) {
        BasicAttachment attachment = basicAttachmentService.getById(id);
        return ResultUtil.ok(attachment);
    }
}

