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.
 
 
 
 
 
 

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