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.
 
 
 
 
 
 

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