using System;
using System.Collections.Generic;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Contracts.DTO;
using IRaCIS.Core.Application.Contracts.RequestAndResponse;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Core.API.Controllers.QA
{
///
/// Qa模板管理
///
[Route("QATemplate")]
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Image")]
[AllowAnonymous]
public class QATemplateController : ControllerBase
{
private readonly IQATemplateService _qaTemplateService;
public QATemplateController(IQATemplateService qaTemplateService)
{
_qaTemplateService = qaTemplateService;
}
[HttpPost, Route("AddOrUpdateQATemplate")]
public IResponseOutput AddOrUpdateQATemplate(QATemplateCommand qaTemplateCommand)
{
return _qaTemplateService.AddOrUpdateQATemplate(qaTemplateCommand);
}
///
/// 获取QA模板列表
///
///
///
[HttpPost, Route("GetQaTemplateList")]
public IResponseOutput> GetQaTemplateList(QATemplateQueryDTO qaTemplateQuery)
{
return ResponseOutput.Ok(_qaTemplateService.GetQaTemplateList(qaTemplateQuery));
}
///
/// 添加Qa记录时 需要选择模板 这里是模板 下拉框选择列表
///
///
[HttpGet, Route("GetQaTemplateSelectList")]
public IResponseOutput> GetQaTemplateSelectList()
{
return ResponseOutput.Ok(_qaTemplateService.GetQaTemplateSelectList());
}
///
/// 删除 QA模板
///
///
///
[HttpDelete, Route("DeleteQATemplate/{qaTemplateId:guid}")]
public IResponseOutput DeleteQATemplate(Guid qaTemplateId)
{
return _qaTemplateService.DeleteQATemplate(qaTemplateId);
}
///
/// 获取某一Qa模板已配置项
///
///
///
[HttpGet, Route("GetQaTemplateItemsById/{qaTemplateId:guid}")]
public IResponseOutput> GetQaTemplateItemsById(Guid qaTemplateId)
{
return ResponseOutput.Ok(_qaTemplateService.GetQaTemplateItemsById(qaTemplateId));
}
///
/// 获取某一QA模板 配置列表(拥有得Item IsSelect 为true)
///
///
///
[HttpGet, Route("GetQaTemplateConfigList/{qaTemplateId:guid}")]
public IResponseOutput> GetQaTemplateConfigList(Guid qaTemplateId)
{
return ResponseOutput.Ok(_qaTemplateService.GetQaTemplateConfigList(qaTemplateId));
}
///
/// 配置Qa模板 和字典表中基础数据 关联关系 IsSelect 为true 添加 false 删除
///
///
///
[HttpPost, Route("ConfigQATemplate")]
public IResponseOutput ConfigQATemplate(QATemplateConfigCommand qaTemplateConfigCommand)
{
return _qaTemplateService.ConfigQATemplate(qaTemplateConfigCommand);
}
}
}