97 lines
3.2 KiB
C#
97 lines
3.2 KiB
C#
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
|
|
{
|
|
/// <summary>
|
|
/// 数据字典-基础数据维护
|
|
/// </summary>
|
|
[Route("dictionary")]
|
|
[ApiController, Authorize, ApiExplorerSettings(GroupName = "Common")]
|
|
public class DictionaryController : ControllerBase
|
|
{
|
|
private IDictionaryService _dictionaryService;
|
|
public DictionaryController(IDictionaryService dictionaryService)
|
|
{
|
|
_dictionaryService = dictionaryService;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取项目多选字典
|
|
/// </summary>
|
|
/// <param name="searchArray">Title、Department、Rank、Position、ReadingType、Subspeciality Sponsor CROCompany ReadingStandard ReviewMode ReviewType ProjectState</param>
|
|
/// <returns></returns>
|
|
[HttpPost, Route("getDictionary")]
|
|
public IResponseOutput<DicResultDTO> GetDic(string[] searchArray)
|
|
{
|
|
var dicResult = _dictionaryService.GetDictionaryResult(searchArray);
|
|
|
|
return ResponseOutput.Ok(dicResult);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取所有字典数据
|
|
/// </summary>
|
|
[HttpGet, Route("getAllDictionary")]
|
|
public IResponseOutput<DicResultDTO> GetAllDic()
|
|
{
|
|
return ResponseOutput.Ok(_dictionaryService.GetAllDictionary());
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 获取下拉框数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet, Route("getDictionarySelect")]
|
|
public IResponseOutput<IEnumerable<string>> GetDicSelect()
|
|
{
|
|
return ResponseOutput.Ok(_dictionaryService.GetDicSelect());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取下拉框某个keyName的列表
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpPost, Route("getDictionarySelectList")]
|
|
public IResponseOutput<PageOutput<DicViewModelDTO>> GetDicSelectList(DicQueryDTO dicSearchModel)
|
|
{
|
|
return ResponseOutput.Ok(_dictionaryService.GetDicSelectList(dicSearchModel));
|
|
}
|
|
|
|
/// <summary> 添加字典 项 </summary>
|
|
[HttpPost, Route("addOrUpdateDictionary")]
|
|
public IResponseOutput AddOrUpdateDictionaryItem(DicViewModelDTO item)
|
|
{
|
|
return ResponseOutput.Ok(_dictionaryService.AddOrUpdateDictionary(item));
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据Id 删除字典数据
|
|
/// </summary>
|
|
/// <param name="id"></param>
|
|
/// <returns></returns>
|
|
|
|
[HttpDelete, Route("deleteDictionary/{id:guid}")]
|
|
public IResponseOutput DeleteDictionary(Guid id)
|
|
{
|
|
return _dictionaryService.DeleteDictionary(id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取字典Tree
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[HttpGet, Route("getDicTree")]
|
|
public IResponseOutput<List<DictionaryTreeNode>> GetDicTree()
|
|
{
|
|
return ResponseOutput.Ok(_dictionaryService.GetDicTree());
|
|
}
|
|
}
|
|
} |