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.
 
 
 
 
 
 

164 lines
4.7 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.Linq;
  8. using System.Text;
  9. namespace Learun.Application.TwoDevelopment.AssetManagementSystem
  10. {
  11. /// <summary>
  12. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  13. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2022-11-07 12:26
  16. /// 描 述:经费申报明细
  17. /// </summary>
  18. public class FundsApplyDetailService : RepositoryFactory
  19. {
  20. #region 获取数据
  21. /// <summary>
  22. /// 获取页面显示列表数据
  23. /// </summary>
  24. /// <param name="pagination">查询参数</param>
  25. /// <param name="queryJson">查询参数</param>
  26. /// <returns></returns>
  27. public IEnumerable<FundsApplyDetailEntity> GetPageList(Pagination pagination, string queryJson)
  28. {
  29. try
  30. {
  31. var strSql = new StringBuilder();
  32. strSql.Append("SELECT ");
  33. strSql.Append(@" t.* ");
  34. strSql.Append(" FROM FundsApplyDetail t ");
  35. strSql.Append(" WHERE 1=1 ");
  36. var queryParam = queryJson.ToJObject();
  37. // 虚拟参数
  38. var dp = new DynamicParameters(new { });
  39. return this.BaseRepository("CollegeMIS").FindList<FundsApplyDetailEntity>(strSql.ToString(), dp, pagination);
  40. }
  41. catch (Exception ex)
  42. {
  43. if (ex is ExceptionEx)
  44. {
  45. throw;
  46. }
  47. else
  48. {
  49. throw ExceptionEx.ThrowServiceException(ex);
  50. }
  51. }
  52. }
  53. /// <summary>
  54. /// 获取FundsApplyDetail表实体数据
  55. /// </summary>
  56. /// <param name="keyValue">主键</param>
  57. /// <returns></returns>
  58. public FundsApplyDetailEntity GetFundsApplyDetailEntity(string keyValue)
  59. {
  60. try
  61. {
  62. return this.BaseRepository("CollegeMIS").FindEntity<FundsApplyDetailEntity>(keyValue);
  63. }
  64. catch (Exception ex)
  65. {
  66. if (ex is ExceptionEx)
  67. {
  68. throw;
  69. }
  70. else
  71. {
  72. throw ExceptionEx.ThrowServiceException(ex);
  73. }
  74. }
  75. }
  76. public List<FundsApplyDetailEntity> GetListByApplyId(string applyId)
  77. {
  78. try
  79. {
  80. return this.BaseRepository("CollegeMIS").FindList<FundsApplyDetailEntity>(x => x.ApplyId == applyId).ToList();
  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. /// </summary>
  99. /// <param name="keyValue">主键</param>
  100. public void DeleteEntity(string keyValue)
  101. {
  102. try
  103. {
  104. this.BaseRepository("CollegeMIS").Delete<FundsApplyDetailEntity>(t => t.Id == keyValue);
  105. }
  106. catch (Exception ex)
  107. {
  108. if (ex is ExceptionEx)
  109. {
  110. throw;
  111. }
  112. else
  113. {
  114. throw ExceptionEx.ThrowServiceException(ex);
  115. }
  116. }
  117. }
  118. /// <summary>
  119. /// 保存实体数据(新增、修改)
  120. /// </summary>
  121. /// <param name="keyValue">主键</param>
  122. /// <param name="entity">实体</param>
  123. public void SaveEntity(string keyValue, FundsApplyDetailEntity entity)
  124. {
  125. try
  126. {
  127. if (!string.IsNullOrEmpty(keyValue))
  128. {
  129. entity.Modify(keyValue);
  130. this.BaseRepository("CollegeMIS").Update(entity);
  131. }
  132. else
  133. {
  134. entity.Create();
  135. this.BaseRepository("CollegeMIS").Insert(entity);
  136. }
  137. }
  138. catch (Exception ex)
  139. {
  140. if (ex is ExceptionEx)
  141. {
  142. throw;
  143. }
  144. else
  145. {
  146. throw ExceptionEx.ThrowServiceException(ex);
  147. }
  148. }
  149. }
  150. #endregion
  151. }
  152. }