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.
 
 
 
 
 
 

147 lines
4.2 KiB

  1. using Dapper;
  2. using Learun.DataBase.Repository;
  3. using Learun.Util;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Text;
  8. namespace Learun.Application.TwoDevelopment.PersonnelManagement
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2020-02-14 12:15
  15. /// 描 述:校妇联管理
  16. /// </summary>
  17. public class SchoolWomenManagementService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取页面显示列表数据
  22. /// <summary>
  23. /// <param name="queryJson">查询参数</param>
  24. /// <returns></returns>
  25. public IEnumerable<SchoolWomenManagementEntity> GetPageList(Pagination pagination, string queryJson)
  26. {
  27. try
  28. {
  29. var strSql = new StringBuilder();
  30. strSql.Append("SELECT ");
  31. strSql.Append(@"
  32. t.Id,
  33. t.Time,
  34. t.Content
  35. ");
  36. strSql.Append(" FROM SchoolWomenManagement t ");
  37. strSql.Append(" WHERE 1=1 ");
  38. var queryParam = queryJson.ToJObject();
  39. // 虚拟参数
  40. var dp = new DynamicParameters(new { });
  41. return this.BaseRepository("CollegeMIS").FindList<SchoolWomenManagementEntity>(strSql.ToString(),dp, pagination);
  42. }
  43. catch (Exception ex)
  44. {
  45. if (ex is ExceptionEx)
  46. {
  47. throw;
  48. }
  49. else
  50. {
  51. throw ExceptionEx.ThrowServiceException(ex);
  52. }
  53. }
  54. }
  55. /// <summary>
  56. /// 获取SchoolWomenManagement表实体数据
  57. /// <param name="keyValue">主键</param>
  58. /// <summary>
  59. /// <returns></returns>
  60. public SchoolWomenManagementEntity GetSchoolWomenManagementEntity(string keyValue)
  61. {
  62. try
  63. {
  64. return this.BaseRepository("CollegeMIS").FindEntity<SchoolWomenManagementEntity>(keyValue);
  65. }
  66. catch (Exception ex)
  67. {
  68. if (ex is ExceptionEx)
  69. {
  70. throw;
  71. }
  72. else
  73. {
  74. throw ExceptionEx.ThrowServiceException(ex);
  75. }
  76. }
  77. }
  78. #endregion
  79. #region 提交数据
  80. /// <summary>
  81. /// 删除实体数据
  82. /// <param name="keyValue">主键</param>
  83. /// <summary>
  84. /// <returns></returns>
  85. public void DeleteEntity(string keyValue)
  86. {
  87. try
  88. {
  89. this.BaseRepository("CollegeMIS").Delete<SchoolWomenManagementEntity>(t=>t.Id == keyValue);
  90. }
  91. catch (Exception ex)
  92. {
  93. if (ex is ExceptionEx)
  94. {
  95. throw;
  96. }
  97. else
  98. {
  99. throw ExceptionEx.ThrowServiceException(ex);
  100. }
  101. }
  102. }
  103. /// <summary>
  104. /// 保存实体数据(新增、修改)
  105. /// <param name="keyValue">主键</param>
  106. /// <summary>
  107. /// <returns></returns>
  108. public void SaveEntity(string keyValue, SchoolWomenManagementEntity entity)
  109. {
  110. try
  111. {
  112. if (!string.IsNullOrEmpty(keyValue))
  113. {
  114. entity.Modify(keyValue);
  115. this.BaseRepository("CollegeMIS").Update(entity);
  116. }
  117. else
  118. {
  119. entity.Create();
  120. this.BaseRepository("CollegeMIS").Insert(entity);
  121. }
  122. }
  123. catch (Exception ex)
  124. {
  125. if (ex is ExceptionEx)
  126. {
  127. throw;
  128. }
  129. else
  130. {
  131. throw ExceptionEx.ThrowServiceException(ex);
  132. }
  133. }
  134. }
  135. #endregion
  136. }
  137. }