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.
 
 
 
 
 
 

163 lines
4.8 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.EducationalAdministration
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2020-03-23 10:58
  15. /// 描 述:保险办理
  16. /// </summary>
  17. public class InsuranceHandleService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取页面显示列表数据
  22. /// <summary>
  23. /// <param name="queryJson">查询参数</param>
  24. /// <returns></returns>
  25. public IEnumerable<InsuranceHandleEntity> 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.StuNo,
  34. t.StuName,
  35. t.Name,
  36. t.Money,
  37. t.StartTime,
  38. t.EndTime,
  39. t.HandleTime,
  40. t.OperatePerson
  41. ");
  42. strSql.Append(" FROM InsuranceHandle t ");
  43. strSql.Append(" WHERE 1=1 ");
  44. var queryParam = queryJson.ToJObject();
  45. // 虚拟参数
  46. var dp = new DynamicParameters(new { });
  47. if (!queryParam["Name"].IsEmpty())
  48. {
  49. dp.Add("Name", "%" + queryParam["Name"].ToString() + "%", DbType.String);
  50. strSql.Append(" AND t.Name Like @Name ");
  51. }
  52. if (!queryParam["OperatePerson"].IsEmpty())
  53. {
  54. dp.Add("OperatePerson", "%" + queryParam["OperatePerson"].ToString() + "%", DbType.String);
  55. strSql.Append(" AND t.OperatePerson Like @OperatePerson ");
  56. }
  57. return this.BaseRepository("CollegeMIS").FindList<InsuranceHandleEntity>(strSql.ToString(),dp, pagination);
  58. }
  59. catch (Exception ex)
  60. {
  61. if (ex is ExceptionEx)
  62. {
  63. throw;
  64. }
  65. else
  66. {
  67. throw ExceptionEx.ThrowServiceException(ex);
  68. }
  69. }
  70. }
  71. /// <summary>
  72. /// 获取InsuranceHandle表实体数据
  73. /// <param name="keyValue">主键</param>
  74. /// <summary>
  75. /// <returns></returns>
  76. public InsuranceHandleEntity GetInsuranceHandleEntity(string keyValue)
  77. {
  78. try
  79. {
  80. return this.BaseRepository("CollegeMIS").FindEntity<InsuranceHandleEntity>(keyValue);
  81. }
  82. catch (Exception ex)
  83. {
  84. if (ex is ExceptionEx)
  85. {
  86. throw;
  87. }
  88. else
  89. {
  90. throw ExceptionEx.ThrowServiceException(ex);
  91. }
  92. }
  93. }
  94. #endregion
  95. #region 提交数据
  96. /// <summary>
  97. /// 删除实体数据
  98. /// <param name="keyValue">主键</param>
  99. /// <summary>
  100. /// <returns></returns>
  101. public void DeleteEntity(string keyValue)
  102. {
  103. try
  104. {
  105. this.BaseRepository("CollegeMIS").Delete<InsuranceHandleEntity>(t=>t.Id == keyValue);
  106. }
  107. catch (Exception ex)
  108. {
  109. if (ex is ExceptionEx)
  110. {
  111. throw;
  112. }
  113. else
  114. {
  115. throw ExceptionEx.ThrowServiceException(ex);
  116. }
  117. }
  118. }
  119. /// <summary>
  120. /// 保存实体数据(新增、修改)
  121. /// <param name="keyValue">主键</param>
  122. /// <summary>
  123. /// <returns></returns>
  124. public void SaveEntity(string keyValue, InsuranceHandleEntity entity)
  125. {
  126. try
  127. {
  128. if (!string.IsNullOrEmpty(keyValue))
  129. {
  130. entity.Modify(keyValue);
  131. this.BaseRepository("CollegeMIS").Update(entity);
  132. }
  133. else
  134. {
  135. entity.Create();
  136. this.BaseRepository("CollegeMIS").Insert(entity);
  137. }
  138. }
  139. catch (Exception ex)
  140. {
  141. if (ex is ExceptionEx)
  142. {
  143. throw;
  144. }
  145. else
  146. {
  147. throw ExceptionEx.ThrowServiceException(ex);
  148. }
  149. }
  150. }
  151. #endregion
  152. }
  153. }