123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Bowin.Common.ServiceToken.Permission;
- using Bowin.Common.WebModels;
- using YLShipBuildLandMap.Entity;
- using YLShipBuildLandMap.Entity.ViewModel;
- using YLShipBuildLandMap.Services.SystemSetting;
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Http;
- using Microsoft.AspNetCore.Mvc;
- using Newtonsoft.Json.Linq;
- namespace YLShipBuildLandMap.Web.Controllers.SystemSetting
- {
- [Route("api/systemsetting/[controller]/[action]")]
- [ApiController]
- [Authorize]
- public class DictionaryController : ControllerBase
- {
- private IDictionaryService DictionaryService { get; set; }
- public DictionaryController(IDictionaryService dictionaryService)
- {
- DictionaryService = dictionaryService;
- }
- [HttpPost]
- [FunctionCode("9904")]
- public async Task<ResultMessage> GetList([FromBody] dynamic inputObject)
- {
- try
- {
- int? pageIndex = inputObject.pageIndex;
- int? pageSize = inputObject.pageSize;
- string dictionaryName = inputObject.dictionaryName;
- string dictionaryCode = inputObject.dictionaryCode;
- string name = inputObject.name;
- var dictionaryItemList = await DictionaryService.GetDictionaryItemList(pageIndex, pageSize, dictionaryName, dictionaryCode, name);
- return ResultMessage.Success(dictionaryItemList);
- }
- catch (Exception ex)
- {
- return ResultMessage.GetError(ex.Message);
- }
- }
- [HttpPost]
- public async Task<ResultMessage> GetDicList([FromBody] dynamic inputObject)
- {
- string code = inputObject.code;
- var list = await DictionaryService.GetDictionaryItemsbyCache(code);
- //System.Threading.Thread.Sleep(TimeSpan.FromSeconds(3));
- // var a = ResultMessage.Success(list);
- return ResultMessage.Success(list);
-
- }
- [HttpPost]
- public async Task<ResultMessage> GetTugboatTitleDicList([FromBody] dynamic inputObject)
- {
- string code = "TugboatTitle";
- var list = await DictionaryService.GetTugboatTitleDictionary(code);
- //System.Threading.Thread.Sleep(TimeSpan.FromSeconds(3));
- return ResultMessage.Success(list);
- }
- [HttpPost]
- public async Task<ResultMessage> GetDepartmentTitleDicList([FromBody] dynamic inputObject)
- {
- string code = "TugboatTitle";
- var list = await DictionaryService.GetDepartmentTitleDictionary(code);
- //System.Threading.Thread.Sleep(TimeSpan.FromSeconds(3));
- return ResultMessage.Success(list);
- }
- [HttpPost]
- public async Task<ResultMessage> GetDicListForSelect([FromBody] dynamic inputObject)
- {
- try
- {
- int? pageIndex = inputObject.pageindex;
- int? pageSize = inputObject.pagesize;
- string dictionaryName = inputObject.name;
- string dictionaryCode = inputObject.code;
- var dicList = await DictionaryService.GetDictionaryList(pageIndex, pageSize, dictionaryName, dictionaryCode);
- return ResultMessage.Success(dicList);
- }
- catch (Exception ex)
- {
- return ResultMessage.GetError(ex.Message);
- }
- }
- [HttpPost]
- [FunctionCode("990401")]
- public ResultMessage GetDicItem([FromBody] dynamic inputObject)
- {
- Guid? dicItemID = inputObject.dicItemID;
- return ResultMessage.Success(DictionaryService.GetDicItem(dicItemID));
- }
- [HttpPost]
- [FunctionCode("990402")]
- public async Task<ResultMessage> EditDicItem([FromBody] dynamic inputObject)
- {
- SysDictionaryItem dicItem = inputObject.dicItem.ToObject<SysDictionaryItem>();
- await DictionaryService.Save(dicItem, LoginUser.Current.UserID);
- return ResultMessage.Success();
- }
- [HttpPost]
- [FunctionCode("990403")]
- public async Task<ResultMessage> Delete([FromBody] dynamic inputObj)
- {
- try
- {
- List<Guid> dicItemIDList = inputObj.dicItemIDs.ToObject<List<Guid>>(); ;
- await DictionaryService.Delete(dicItemIDList);
- return ResultMessage.Success();
- }
- catch (Exception ex)
- {
- return ResultMessage.GetError(ex.Message);
- }
- }
- }
- }
|