Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

171 righe
4.9 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. /// 日 期:2021-10-15 10:08
  15. /// 描 述:教学计划--课程子表
  16. /// </summary>
  17. public class TeachingPlanItemService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取页面显示列表数据
  22. /// </summary>
  23. /// <param name="pagination">查询参数</param>
  24. /// <param name="queryJson">查询参数</param>
  25. /// <returns></returns>
  26. public IEnumerable<TeachingPlanItemEntity> GetPageList(Pagination pagination, string queryJson)
  27. {
  28. try
  29. {
  30. var strSql = new StringBuilder();
  31. strSql.Append("SELECT ");
  32. strSql.Append(@"
  33. t.Id,
  34. t.Semester,
  35. t.WeeklyFestival,
  36. t.WeeklyStart,
  37. t.WeeklyEnd
  38. ");
  39. strSql.Append(" FROM TeachingPlanItem t ");
  40. strSql.Append(" WHERE 1=1 ");
  41. var queryParam = queryJson.ToJObject();
  42. // 虚拟参数
  43. var dp = new DynamicParameters(new { });
  44. return this.BaseRepository("CollegeMIS").FindList<TeachingPlanItemEntity>(strSql.ToString(), dp, pagination);
  45. }
  46. catch (Exception ex)
  47. {
  48. if (ex is ExceptionEx)
  49. {
  50. throw;
  51. }
  52. else
  53. {
  54. throw ExceptionEx.ThrowServiceException(ex);
  55. }
  56. }
  57. }
  58. /// <summary>
  59. /// 获取TeachingPlanItem表数据
  60. /// </summary>
  61. /// <returns></returns>
  62. public IEnumerable<TeachingPlanItemEntity> GetListByPlanId(string PlanId)
  63. {
  64. try
  65. {
  66. return this.BaseRepository("CollegeMIS").FindList<TeachingPlanItemEntity>(x => x.TeachingPlanId == PlanId);
  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. /// 获取TeachingPlanItem表实体数据
  82. /// </summary>
  83. /// <param name="keyValue">主键</param>
  84. /// <returns></returns>
  85. public TeachingPlanItemEntity GetTeachingPlanItemEntity(string keyValue)
  86. {
  87. try
  88. {
  89. return this.BaseRepository("CollegeMIS").FindEntity<TeachingPlanItemEntity>(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<TeachingPlanItemEntity>(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. /// </summary>
  130. /// <param name="keyValue">主键</param>
  131. /// <param name="entity">实体</param>
  132. public void SaveEntity(string keyValue, TeachingPlanItemEntity 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. }