DepOrServiceController.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Bowin.Common.WebModels;
  2. using Microsoft.AspNetCore.Authorization;
  3. using Microsoft.AspNetCore.Mvc;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Threading.Tasks;
  8. using YLShipBuildLandMap.Entity.ViewModel;
  9. using YLShipBuildLandMap.Entity.ViewModel.Build;
  10. using YLShipBuildLandMap.Services.Build;
  11. namespace YLShipBuildLandMap.Web.Controllers.Build
  12. {
  13. [Route("api/build/[controller]/[action]")]
  14. [Authorize]
  15. [ApiController]
  16. public class DepOrServiceController : ControllerBase
  17. {
  18. private IDepOrServicePointService DepOrServicePointService { get; set; }
  19. public DepOrServiceController(IDepOrServicePointService depOrServicePointService)
  20. {
  21. DepOrServicePointService = depOrServicePointService;
  22. }
  23. [HttpGet]
  24. public async Task<ResultMessage> GetDepOrServicePointList(int pageIndex, int pageSize, Guid? buildingId, Guid? floorId,string name)
  25. {
  26. return ResultMessage.Success(DepOrServicePointService.GetDepOrServicePointList(pageIndex, pageSize, buildingId, floorId, name));
  27. }
  28. [HttpGet]
  29. public async Task<ResultMessage> GetDepOrServicePointById(Guid? depOrServicePointId)
  30. {
  31. return ResultMessage.Success(await DepOrServicePointService.GetDepOrServicePointById(depOrServicePointId));
  32. }
  33. [HttpPost]
  34. public async Task<ResultMessage> Delete([FromBody] dynamic inputObject)
  35. {
  36. List<Guid> depOrServicePointIdList = inputObject.depOrServicePointIdList.ToObject<List<Guid>>();
  37. return ResultMessage.Success(await DepOrServicePointService.Delete(depOrServicePointIdList));
  38. }
  39. [HttpPost]
  40. public async Task<ResultMessage> Save([FromBody] dynamic inputObj)
  41. {
  42. DepOrServicePointView data = inputObj["data"].ToObject<DepOrServicePointView>();
  43. List<Guid> roomIdList = inputObj["roomIdList"].ToObject<List<Guid>>();
  44. return ResultMessage.Success(await DepOrServicePointService.Save(data, roomIdList, LoginUser.Current.UserID));
  45. }
  46. [HttpGet]
  47. public async Task<ResultMessage> GetRoomList(Guid depOrServicePointId)
  48. {
  49. return ResultMessage.Success(await DepOrServicePointService.GetRoomList(depOrServicePointId));
  50. }
  51. }
  52. }