using System;
using System.Collections.Generic;
using IRaCIS.Application.Interfaces;
using IRaCIS.Application.ViewModels;
using IRaCIS.Core.Application.Contracts.RequestAndResponse;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace IRaCIS.Api.Controllers
{
///
/// 数据字典-基础数据维护
///
[Route("dictionary")]
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Common")]
public class DictionaryController : ControllerBase
{
private IDictionaryService _dictionaryService;
public DictionaryController(IDictionaryService dictionaryService)
{
_dictionaryService = dictionaryService;
}
///
/// 获取项目多选字典
///
/// Title、Department、Rank、Position、ReadingType、Subspeciality Sponsor CROCompany ReadingStandard ReviewMode ReviewType ProjectState
///
[HttpPost, Route("getDictionary")]
public IResponseOutput GetDic(string[] searchArray)
{
var dicResult = _dictionaryService.GetDictionaryResult(searchArray);
return ResponseOutput.Ok(dicResult);
}
///
/// 获取所有字典数据
///
[HttpGet, Route("getAllDictionary")]
public IResponseOutput GetAllDic()
{
return ResponseOutput.Ok(_dictionaryService.GetAllDictionary());
}
///
/// 获取下拉框数据
///
///
[HttpGet, Route("getDictionarySelect")]
public IResponseOutput> GetDicSelect()
{
return ResponseOutput.Ok(_dictionaryService.GetDicSelect());
}
///
/// 获取下拉框某个keyName的列表
///
///
[HttpPost, Route("getDictionarySelectList")]
public IResponseOutput> GetDicSelectList(DicQueryDTO dicSearchModel)
{
return ResponseOutput.Ok(_dictionaryService.GetDicSelectList(dicSearchModel));
}
/// 添加字典 项
[HttpPost, Route("addOrUpdateDictionary")]
public IResponseOutput AddOrUpdateDictionaryItem(DicViewModelDTO item)
{
return ResponseOutput.Ok(_dictionaryService.AddOrUpdateDictionary(item));
}
///
/// 根据Id 删除字典数据
///
///
///
[HttpDelete, Route("deleteDictionary/{id:guid}")]
public IResponseOutput DeleteDictionary(Guid id)
{
return _dictionaryService.DeleteDictionary(id);
}
///
/// 获取字典Tree
///
///
[HttpGet, Route("getDicTree")]
public IResponseOutput> GetDicTree()
{
return ResponseOutput.Ok(_dictionaryService.GetDicTree());
}
}
}