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.
 
 
 
 
 
 

152 lines
4.5 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-06-12 11:53
  15. /// 描 述:教学调度调课子类
  16. /// </summary>
  17. public class ArrangeLessonTermAttemperChildService : 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<ArrangeLessonTermAttrmperChildEntity> GetPageList(Pagination pagination, string queryJson)
  27. {
  28. try
  29. {
  30. var strSql = new StringBuilder();
  31. strSql.Append("SELECT ");
  32. strSql.Append(@"
  33. t.*
  34. ");
  35. strSql.Append(" FROM ArrangeLessonTermAttrmperChild t ");
  36. strSql.Append(" WHERE 1=1 ");
  37. var queryParam = queryJson.ToJObject();
  38. // 虚拟参数
  39. var dp = new DynamicParameters(new { });
  40. if (!queryParam["AttemperId"].IsEmpty())
  41. {
  42. dp.Add("AttemperId", queryParam["AttemperId"].ToString(), DbType.String);
  43. strSql.Append(" AND t.AttemperId = @AttemperId ");
  44. }
  45. return this.BaseRepository("CollegeMIS").FindList<ArrangeLessonTermAttrmperChildEntity>(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. /// 获取ArrangeLessonTermAttrmperChild表实体数据
  61. /// </summary>
  62. /// <param name="keyValue">主键</param>
  63. /// <returns></returns>
  64. public ArrangeLessonTermAttrmperChildEntity GetArrangeLessonTermAttrmperChildEntity(string keyValue)
  65. {
  66. try
  67. {
  68. return this.BaseRepository("CollegeMIS").FindEntity<ArrangeLessonTermAttrmperChildEntity>(keyValue.ToInt());
  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. #endregion
  83. #region 提交数据
  84. /// <summary>
  85. /// 删除实体数据
  86. /// </summary>
  87. /// <param name="keyValue">主键</param>
  88. public void DeleteEntity( string id)
  89. {
  90. try
  91. {
  92. this.BaseRepository("CollegeMIS").Delete<ArrangeLessonTermAttrmperChildEntity>(t => t.Id == id);
  93. }
  94. catch (Exception ex)
  95. {
  96. if (ex is ExceptionEx)
  97. {
  98. throw;
  99. }
  100. else
  101. {
  102. throw ExceptionEx.ThrowServiceException(ex);
  103. }
  104. }
  105. }
  106. /// <summary>
  107. /// 保存实体数据(新增、修改)
  108. /// </summary>
  109. /// <param name="keyValue">主键</param>
  110. /// <param name="entity">实体</param>
  111. public void SaveEntity( string id, ArrangeLessonTermAttrmperChildEntity entity)
  112. {
  113. try
  114. {
  115. if (string.IsNullOrEmpty(id))
  116. {
  117. entity.Modify(id);
  118. this.BaseRepository("CollegeMIS").Update(entity);
  119. }
  120. else
  121. {
  122. entity.Create();
  123. this.BaseRepository("CollegeMIS").Insert(entity);
  124. }
  125. }
  126. catch (Exception ex)
  127. {
  128. if (ex is ExceptionEx)
  129. {
  130. throw;
  131. }
  132. else
  133. {
  134. throw ExceptionEx.ThrowServiceException(ex);
  135. }
  136. }
  137. }
  138. #endregion
  139. }
  140. }