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.
 
 
 
 
 
 

125 lines
3.9 KiB

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