25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

141 lines
4.5 KiB

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