mtnAlarmShadowRecordController.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using log4net;
  2. using Microsoft.AspNetCore.Http;
  3. using Microsoft.AspNetCore.Mvc;
  4. using Microsoft.Extensions.Logging;
  5. using Ropin.Inspection.Service.MTN.Interface;
  6. using Ropin.Inspection.Service;
  7. using Ropin.Inspection.Api.Common;
  8. using Ropin.Inspection.Model.SearchModel.MTN;
  9. using Ropin.Inspection.Model.ViewModel.MTN;
  10. using Ropin.Inspection.Model;
  11. using System.Threading.Tasks;
  12. using System;
  13. namespace Ropin.Inspection.Api.Controllers.MTN
  14. {
  15. [Route("api/[controller]")]
  16. [ApiController]
  17. public class mtnAlarmShadowRecordController : BaseController
  18. {
  19. private readonly ImtnAlarmShadowRecordService _repository;
  20. private static readonly ILog log = LogManager.GetLogger(typeof(mtnAlarmShadowRecordController));
  21. /// <summary>
  22. /// 构造函数
  23. /// </summary>
  24. /// <param name="repository"></param>
  25. public mtnAlarmShadowRecordController(ImtnAlarmShadowRecordService repository)
  26. {
  27. _repository = repository;
  28. }
  29. /// <summary>
  30. /// 报警影像记录列表
  31. /// </summary>
  32. /// <param name="searchModel"></param>
  33. /// <returns></returns>
  34. [HttpPost("GetPageAsync")]
  35. public async Task<ApiResult> GetPageAsync(AlarmShadowRecordSearch searchModel)
  36. {
  37. if (searchModel == null)
  38. {
  39. return new ApiResult(ReturnCode.ArgsError);
  40. }
  41. try
  42. {
  43. var contentList = await _repository.GetConditionAsync(searchModel);
  44. return new ApiResult<PagesModel<AlarmShadowRecordModel>>(new PagesModel<AlarmShadowRecordModel>(contentList, searchModel));
  45. }
  46. catch (Exception ex)
  47. {
  48. return new ApiResult(ReturnCode.GeneralError, ex.Message);
  49. }
  50. }
  51. }
  52. }