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.
 
 
 
 
 
 

170 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.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(@"
  34. t.Id,
  35. t.ProjectContent,
  36. t.Number,
  37. t.Price,
  38. t.Amount
  39. ");
  40. strSql.Append(" FROM FundsApplyDetail t ");
  41. strSql.Append(" WHERE 1=1 ");
  42. var queryParam = queryJson.ToJObject();
  43. // 虚拟参数
  44. var dp = new DynamicParameters(new { });
  45. return this.BaseRepository("CollegeMIS").FindList<FundsApplyDetailEntity>(strSql.ToString(), dp, pagination);
  46. }
  47. catch (Exception ex)
  48. {
  49. if (ex is ExceptionEx)
  50. {
  51. throw;
  52. }
  53. else
  54. {
  55. throw ExceptionEx.ThrowServiceException(ex);
  56. }
  57. }
  58. }
  59. /// <summary>
  60. /// 获取FundsApplyDetail表实体数据
  61. /// </summary>
  62. /// <param name="keyValue">主键</param>
  63. /// <returns></returns>
  64. public FundsApplyDetailEntity GetFundsApplyDetailEntity(string keyValue)
  65. {
  66. try
  67. {
  68. return this.BaseRepository("CollegeMIS").FindEntity<FundsApplyDetailEntity>(keyValue);
  69. }
  70. catch (Exception ex)
  71. {
  72. if (ex is ExceptionEx)
  73. {
  74. throw;
  75. }
  76. else
  77. {
  78. throw ExceptionEx.ThrowServiceException(ex);
  79. }
  80. }
  81. }
  82. public List<FundsApplyDetailEntity> GetListByApplyId(string applyId)
  83. {
  84. try
  85. {
  86. return this.BaseRepository("CollegeMIS").FindList<FundsApplyDetailEntity>(x => x.ApplyId == applyId).ToList();
  87. }
  88. catch (Exception ex)
  89. {
  90. if (ex is ExceptionEx)
  91. {
  92. throw;
  93. }
  94. else
  95. {
  96. throw ExceptionEx.ThrowServiceException(ex);
  97. }
  98. }
  99. }
  100. #endregion
  101. #region 提交数据
  102. /// <summary>
  103. /// 删除实体数据
  104. /// </summary>
  105. /// <param name="keyValue">主键</param>
  106. public void DeleteEntity(string keyValue)
  107. {
  108. try
  109. {
  110. this.BaseRepository("CollegeMIS").Delete<FundsApplyDetailEntity>(t => t.Id == keyValue);
  111. }
  112. catch (Exception ex)
  113. {
  114. if (ex is ExceptionEx)
  115. {
  116. throw;
  117. }
  118. else
  119. {
  120. throw ExceptionEx.ThrowServiceException(ex);
  121. }
  122. }
  123. }
  124. /// <summary>
  125. /// 保存实体数据(新增、修改)
  126. /// </summary>
  127. /// <param name="keyValue">主键</param>
  128. /// <param name="entity">实体</param>
  129. public void SaveEntity(string keyValue, FundsApplyDetailEntity entity)
  130. {
  131. try
  132. {
  133. if (!string.IsNullOrEmpty(keyValue))
  134. {
  135. entity.Modify(keyValue);
  136. this.BaseRepository("CollegeMIS").Update(entity);
  137. }
  138. else
  139. {
  140. entity.Create();
  141. this.BaseRepository("CollegeMIS").Insert(entity);
  142. }
  143. }
  144. catch (Exception ex)
  145. {
  146. if (ex is ExceptionEx)
  147. {
  148. throw;
  149. }
  150. else
  151. {
  152. throw ExceptionEx.ThrowServiceException(ex);
  153. }
  154. }
  155. }
  156. #endregion
  157. }
  158. }