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.
 
 
 
 
 
 

172 lines
5.0 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 V7.0.6 力软敏捷开发框架
  12. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2023-01-06 11:59
  15. /// 描 述:学生学籍异动记录表
  16. /// </summary>
  17. public class StuInfoBasicTranService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取列表数据
  22. /// </summary>
  23. /// <param name="queryJson">条件参数</param>
  24. /// <returns></returns>
  25. public IEnumerable<StuInfoBasicTranEntity> GetList( string queryJson )
  26. {
  27. try
  28. {
  29. //参考写法
  30. //var queryParam = queryJson.ToJObject();
  31. // 虚拟参数
  32. //var dp = new DynamicParameters(new { });
  33. //dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime);
  34. var strSql = new StringBuilder();
  35. strSql.Append("SELECT ");
  36. strSql.Append(" t.* ");
  37. strSql.Append(" FROM StuInfoBasicTran t ");
  38. return this.BaseRepository("CollegeMIS").FindList<StuInfoBasicTranEntity>(strSql.ToString());
  39. }
  40. catch (Exception ex)
  41. {
  42. if (ex is ExceptionEx)
  43. {
  44. throw;
  45. }
  46. else
  47. {
  48. throw ExceptionEx.ThrowServiceException(ex);
  49. }
  50. }
  51. }
  52. /// <summary>
  53. /// 获取列表分页数据
  54. /// </summary>
  55. /// <param name="pagination">分页参数</param>
  56. /// <param name="queryJson">条件参数</param>
  57. /// <returns></returns>
  58. public IEnumerable<StuInfoBasicTranEntity> GetPageList(Pagination pagination, string queryJson)
  59. {
  60. try
  61. {
  62. var strSql = new StringBuilder();
  63. strSql.Append("SELECT ");
  64. strSql.Append(" t.* ");
  65. strSql.Append(" FROM StuInfoBasicTran t ");
  66. return this.BaseRepository("CollegeMIS").FindList<StuInfoBasicTranEntity>(strSql.ToString(), pagination);
  67. }
  68. catch (Exception ex)
  69. {
  70. if (ex is ExceptionEx)
  71. {
  72. throw;
  73. }
  74. else
  75. {
  76. throw ExceptionEx.ThrowServiceException(ex);
  77. }
  78. }
  79. }
  80. /// <summary>
  81. /// 获取实体数据
  82. /// </summary>
  83. /// <param name="keyValue">主键</param>
  84. /// <returns></returns>
  85. public StuInfoBasicTranEntity GetEntity(string keyValue)
  86. {
  87. try
  88. {
  89. return this.BaseRepository("CollegeMIS").FindEntity<StuInfoBasicTranEntity>(keyValue);
  90. }
  91. catch (Exception ex)
  92. {
  93. if (ex is ExceptionEx)
  94. {
  95. throw;
  96. }
  97. else
  98. {
  99. throw ExceptionEx.ThrowServiceException(ex);
  100. }
  101. }
  102. }
  103. #endregion
  104. #region 提交数据
  105. /// <summary>
  106. /// 删除实体数据
  107. /// </summary>
  108. /// <param name="keyValue">主键</param>
  109. public void DeleteEntity(string keyValue)
  110. {
  111. try
  112. {
  113. this.BaseRepository("CollegeMIS").Delete<StuInfoBasicTranEntity>(t=>t.ID == keyValue);
  114. }
  115. catch (Exception ex)
  116. {
  117. if (ex is ExceptionEx)
  118. {
  119. throw;
  120. }
  121. else
  122. {
  123. throw ExceptionEx.ThrowServiceException(ex);
  124. }
  125. }
  126. }
  127. /// <summary>
  128. /// 保存实体数据(新增、修改)
  129. /// <param name="keyValue">主键</param>
  130. /// <param name="entity">实体</param>
  131. /// </summary>
  132. public void SaveEntity(string keyValue, StuInfoBasicTranEntity entity)
  133. {
  134. try
  135. {
  136. if (!string.IsNullOrEmpty(keyValue))
  137. {
  138. entity.Modify(keyValue);
  139. this.BaseRepository("CollegeMIS").Update(entity);
  140. }
  141. else
  142. {
  143. entity.Create();
  144. this.BaseRepository("CollegeMIS").Insert(entity);
  145. }
  146. }
  147. catch (Exception ex)
  148. {
  149. if (ex is ExceptionEx)
  150. {
  151. throw;
  152. }
  153. else
  154. {
  155. throw ExceptionEx.ThrowServiceException(ex);
  156. }
  157. }
  158. }
  159. #endregion
  160. }
  161. }