package cn.com.tenlion.freemarker.controller.app.apis.templaterecord;

import cn.com.tenlion.freemarker.pojo.dtos.templaterecord.TemplateRecordDTO;
import cn.com.tenlion.freemarker.service.templaterecord.ITemplateRecordService;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.common.component.SecurityComponent;
import ink.wgink.exceptions.SearchException;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.result.ErrorResult;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.AbstractController;


/**
 * @ClassName: TemplateRecordController
 * @Description: 模板构建记录
 * @Author: WenG
 * @Date: 2020-05-07 16:50
 * @Version: 1.0
 **/
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "模板构建记录接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/templaterecord")
public class TemplateRecordAppController extends DefaultBaseController {

    @Autowired
    private ITemplateRecordService templateRecordService;
    @Autowired
    private SecurityComponent securityComponent;

    @ApiOperation(value = "模板构建记录详情(通过ID)", notes = "模板构建记录详情(通过ID)接口")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "templateRecordId", value = "模板构建记录ID", paramType = "path")
    })
    @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
    @GetMapping("gettemplaterecordbyid/{templateRecordId}")
    public TemplateRecordDTO getTemplateRecordById(@PathVariable("templateRecordId") String templateRecordId) throws SearchException {
        return templateRecordService.getTemplateRecordById(templateRecordId);
    }

}