package com.qmth.paper.library.api;

import com.qmth.boot.api.constant.ApiConstant;
import com.qmth.paper.library.common.contant.ApiPrefixConstant;
import com.qmth.paper.library.common.entity.BasicAttachment;
import com.qmth.paper.library.common.service.BasicAttachmentService;
import com.qmth.paper.library.common.util.Result;
import com.qmth.paper.library.common.util.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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;

import javax.annotation.Resource;

/**
 * <p>
 * 所有附件记录表 前端控制器
 * </p>
 */
@Api(tags = "文件上传Controller")
@RestController
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + ApiPrefixConstant.PREFIX_COMMON + "/file")
public class BasicAttachmentController {

    @Resource
    private BasicAttachmentService basicAttachmentService;

    /**
     * 文件查询
     */
    @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);
    }
}

