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.
 
 
 
 
 
 

162 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. /// 日 期:2020-12-17 14:29
  15. /// 描 述:人才培养方案
  16. /// </summary>
  17. public class EATalentTrainService : 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<EATalentTrainEntity> GetPageList(Pagination pagination, string queryJson)
  27. {
  28. try
  29. {
  30. var strSql = new StringBuilder();
  31. strSql.Append("SELECT t.* ");
  32. strSql.Append(" FROM EATalentTrain t ");
  33. strSql.Append(" WHERE 1=1 ");
  34. var queryParam = queryJson.ToJObject();
  35. // 虚拟参数
  36. var dp = new DynamicParameters(new { });
  37. if (!queryParam["AcademicYearNo"].IsEmpty())
  38. {
  39. dp.Add("AcademicYearNo",queryParam["AcademicYearNo"].ToString(), DbType.String);
  40. strSql.Append(" AND t.AcademicYearNo = @AcademicYearNo ");
  41. }
  42. if (!queryParam["Semester"].IsEmpty())
  43. {
  44. dp.Add("Semester",queryParam["Semester"].ToString(), DbType.String);
  45. strSql.Append(" AND t.Semester = @Semester ");
  46. }
  47. if (!queryParam["DeptNo"].IsEmpty())
  48. {
  49. dp.Add("DeptNo",queryParam["DeptNo"].ToString(), DbType.String);
  50. strSql.Append(" AND t.DeptNo = @DeptNo ");
  51. }
  52. if (!queryParam["MajorNo"].IsEmpty())
  53. {
  54. dp.Add("MajorNo",queryParam["MajorNo"].ToString(), DbType.String);
  55. strSql.Append(" AND t.MajorNo = @MajorNo ");
  56. }
  57. return this.BaseRepository("CollegeMIS").FindList<EATalentTrainEntity>(strSql.ToString(),dp, pagination);
  58. }
  59. catch (Exception ex)
  60. {
  61. if (ex is ExceptionEx)
  62. {
  63. throw;
  64. }
  65. else
  66. {
  67. throw ExceptionEx.ThrowServiceException(ex);
  68. }
  69. }
  70. }
  71. /// <summary>
  72. /// 获取EATalentTrain表实体数据
  73. /// </summary>
  74. /// <param name="keyValue">主键</param>
  75. /// <returns></returns>
  76. public EATalentTrainEntity GetEATalentTrainEntity(string keyValue)
  77. {
  78. try
  79. {
  80. return this.BaseRepository("CollegeMIS").FindEntity<EATalentTrainEntity>(keyValue);
  81. }
  82. catch (Exception ex)
  83. {
  84. if (ex is ExceptionEx)
  85. {
  86. throw;
  87. }
  88. else
  89. {
  90. throw ExceptionEx.ThrowServiceException(ex);
  91. }
  92. }
  93. }
  94. #endregion
  95. #region 提交数据
  96. /// <summary>
  97. /// 删除实体数据
  98. /// </summary>
  99. /// <param name="keyValue">主键</param>
  100. public void DeleteEntity(string keyValue)
  101. {
  102. try
  103. {
  104. this.BaseRepository("CollegeMIS").Delete<EATalentTrainEntity>(t=>t.Id == keyValue);
  105. }
  106. catch (Exception ex)
  107. {
  108. if (ex is ExceptionEx)
  109. {
  110. throw;
  111. }
  112. else
  113. {
  114. throw ExceptionEx.ThrowServiceException(ex);
  115. }
  116. }
  117. }
  118. /// <summary>
  119. /// 保存实体数据(新增、修改)
  120. /// </summary>
  121. /// <param name="keyValue">主键</param>
  122. /// <param name="entity">实体</param>
  123. public void SaveEntity(string keyValue, EATalentTrainEntity entity)
  124. {
  125. try
  126. {
  127. if (!string.IsNullOrEmpty(keyValue))
  128. {
  129. entity.Modify(keyValue);
  130. this.BaseRepository("CollegeMIS").Update(entity);
  131. }
  132. else
  133. {
  134. entity.Create();
  135. this.BaseRepository("CollegeMIS").Insert(entity);
  136. }
  137. }
  138. catch (Exception ex)
  139. {
  140. if (ex is ExceptionEx)
  141. {
  142. throw;
  143. }
  144. else
  145. {
  146. throw ExceptionEx.ThrowServiceException(ex);
  147. }
  148. }
  149. }
  150. #endregion
  151. }
  152. }