You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

119 lines
3.7 KiB

  1. using Nancy;
  2. using Learun.Util;
  3. using System.Collections.Generic;
  4. using Learun.Application.TwoDevelopment.EducationalAdministration;
  5. namespace Learun.Application.WebApi
  6. {
  7. /// <summary>
  8. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  9. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  10. /// 创 建:超级管理员
  11. /// 日 期:2019-07-01 17:06
  12. /// 描 述:邮件查看
  13. /// </summary>
  14. public class JournalReceiveApi : BaseApi
  15. {
  16. private JournalReceiveIBLL journalReceiveIBLL = new JournalReceiveBLL();
  17. /// <summary>
  18. /// 注册接口
  19. /// <summary>
  20. public JournalReceiveApi()
  21. : base("/Learun/EducationalAdministration/JournalReceive")
  22. {
  23. Get["/pagelist"] = GetPageList;
  24. Get["/list"] = GetList;
  25. Get["/form"] = GetForm;
  26. Post["/delete"] = DeleteForm;
  27. Post["/save"] = SaveForm;
  28. }
  29. #region 获取数据
  30. /// <summary>
  31. /// 获取页面显示列表分页数据
  32. /// <summary>
  33. /// <param name="_"></param>
  34. /// <returns></returns>
  35. public Response GetPageList(dynamic _)
  36. {
  37. ReqPageParam parameter = this.GetReqData<ReqPageParam>();
  38. var data = journalReceiveIBLL.GetPageList(parameter.pagination, parameter.queryJson);
  39. var jsonData = new
  40. {
  41. rows = data,
  42. total = parameter.pagination.total,
  43. page = parameter.pagination.page,
  44. records = parameter.pagination.records
  45. };
  46. return Success(jsonData);
  47. }
  48. /// <summary>
  49. /// 获取页面显示列表数据
  50. /// <summary>
  51. /// <param name="_"></param>
  52. /// <returns></returns>
  53. public Response GetList(dynamic _)
  54. {
  55. string queryJson = this.GetReqData();
  56. var data = journalReceiveIBLL.GetList(queryJson);
  57. return Success(data);
  58. }
  59. /// <summary>
  60. /// 获取表单数据
  61. /// <summary>
  62. /// <param name="_"></param>
  63. /// <returns></returns>
  64. public Response GetForm(dynamic _)
  65. {
  66. string keyValue = this.GetReqData();
  67. var JournalReceiveData = journalReceiveIBLL.GetJournalReceiveEntity(keyValue);
  68. var jsonData = new
  69. {
  70. JournalReceive = JournalReceiveData,
  71. };
  72. return Success(jsonData);
  73. }
  74. #endregion
  75. #region 提交数据
  76. /// <summary>
  77. /// 删除实体数据
  78. /// <param name="_"></param>
  79. /// <summary>
  80. /// <returns></returns>
  81. public Response DeleteForm(dynamic _)
  82. {
  83. string keyValue = this.GetReqData();
  84. journalReceiveIBLL.DeleteEntity(keyValue);
  85. return Success("删除成功!");
  86. }
  87. /// <summary>
  88. /// 保存实体数据(新增、修改)
  89. /// <param name="_"></param>
  90. /// <summary>
  91. /// <returns></returns>
  92. public Response SaveForm(dynamic _)
  93. {
  94. ReqFormEntity parameter = this.GetReqData<ReqFormEntity>();
  95. JournalReceiveEntity entity = parameter.strEntity.ToObject<JournalReceiveEntity>();
  96. journalReceiveIBLL.SaveEntity(this.userInfo, parameter.keyValue, entity);
  97. return Success("保存成功!");
  98. }
  99. #endregion
  100. #region 私有类
  101. /// <summary>
  102. /// 表单实体类
  103. /// <summary>
  104. private class ReqFormEntity
  105. {
  106. public string keyValue { get; set; }
  107. public string strEntity { get; set; }
  108. }
  109. #endregion
  110. }
  111. }