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.
 
 
 
 
 
 

155 lines
4.5 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-28 17:37
  15. /// 描 述:团费管理
  16. /// </summary>
  17. public class LeagueMemberDuesService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取页面显示列表数据
  22. /// <summary>
  23. /// <param name="queryJson">查询参数</param>
  24. /// <returns></returns>
  25. public IEnumerable<LeagueMemberDuesEntity> 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.LeagueMember,
  34. t.PayTime,
  35. t.Fees,
  36. t.Status,
  37. t.CheckStatus
  38. ");
  39. strSql.Append(" FROM LeagueMemberDues t ");
  40. strSql.Append(" WHERE 1=1 ");
  41. var queryParam = queryJson.ToJObject();
  42. // 虚拟参数
  43. var dp = new DynamicParameters(new { });
  44. if (!queryParam["LeagueMember"].IsEmpty())
  45. {
  46. dp.Add("LeagueMember", "%" + queryParam["LeagueMember"].ToString() + "%", DbType.String);
  47. strSql.Append(" AND t.LeagueMember Like @LeagueMember ");
  48. }
  49. return this.BaseRepository("CollegeMIS").FindList<LeagueMemberDuesEntity>(strSql.ToString(),dp, pagination);
  50. }
  51. catch (Exception ex)
  52. {
  53. if (ex is ExceptionEx)
  54. {
  55. throw;
  56. }
  57. else
  58. {
  59. throw ExceptionEx.ThrowServiceException(ex);
  60. }
  61. }
  62. }
  63. /// <summary>
  64. /// 获取LeagueMemberDues表实体数据
  65. /// <param name="keyValue">主键</param>
  66. /// <summary>
  67. /// <returns></returns>
  68. public LeagueMemberDuesEntity GetLeagueMemberDuesEntity(string keyValue)
  69. {
  70. try
  71. {
  72. return this.BaseRepository("CollegeMIS").FindEntity<LeagueMemberDuesEntity>(keyValue);
  73. }
  74. catch (Exception ex)
  75. {
  76. if (ex is ExceptionEx)
  77. {
  78. throw;
  79. }
  80. else
  81. {
  82. throw ExceptionEx.ThrowServiceException(ex);
  83. }
  84. }
  85. }
  86. #endregion
  87. #region 提交数据
  88. /// <summary>
  89. /// 删除实体数据
  90. /// <param name="keyValue">主键</param>
  91. /// <summary>
  92. /// <returns></returns>
  93. public void DeleteEntity(string keyValue)
  94. {
  95. try
  96. {
  97. this.BaseRepository("CollegeMIS").Delete<LeagueMemberDuesEntity>(t=>t.Id == keyValue);
  98. }
  99. catch (Exception ex)
  100. {
  101. if (ex is ExceptionEx)
  102. {
  103. throw;
  104. }
  105. else
  106. {
  107. throw ExceptionEx.ThrowServiceException(ex);
  108. }
  109. }
  110. }
  111. /// <summary>
  112. /// 保存实体数据(新增、修改)
  113. /// <param name="keyValue">主键</param>
  114. /// <summary>
  115. /// <returns></returns>
  116. public void SaveEntity(string keyValue, LeagueMemberDuesEntity entity)
  117. {
  118. try
  119. {
  120. if (!string.IsNullOrEmpty(keyValue))
  121. {
  122. entity.Modify(keyValue);
  123. this.BaseRepository("CollegeMIS").Update(entity);
  124. }
  125. else
  126. {
  127. entity.Create();
  128. this.BaseRepository("CollegeMIS").Insert(entity);
  129. }
  130. }
  131. catch (Exception ex)
  132. {
  133. if (ex is ExceptionEx)
  134. {
  135. throw;
  136. }
  137. else
  138. {
  139. throw ExceptionEx.ThrowServiceException(ex);
  140. }
  141. }
  142. }
  143. #endregion
  144. }
  145. }