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.
 
 
 
 
 
 

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