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.
 
 
 
 
 
 

173 lines
4.9 KiB

  1. using Dapper;
  2. using Learun.Application.Organization;
  3. using Learun.Application.TwoDevelopment.EducationalAdministration;
  4. using Learun.DataBase.Repository;
  5. using Learun.Util;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Data;
  9. using System.Text;
  10. namespace Learun.Application.TwoDevelopment.PersonnelManagement
  11. {
  12. /// <summary>
  13. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  14. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  15. /// 创 建:超级管理员
  16. /// 日 期:2019-03-19 11:34
  17. /// 描 述:教师培训信息
  18. /// </summary>
  19. public class TeacherTrainService : RepositoryFactory
  20. {
  21. #region 获取数据
  22. /// <summary>
  23. /// 获取页面显示列表数据
  24. /// <summary>
  25. /// <param name="queryJson">查询参数</param>
  26. /// <returns></returns>
  27. public IEnumerable<TeacherTrainEntity> GetPageList(Pagination pagination, string queryJson)
  28. {
  29. try
  30. {
  31. var strSql = new StringBuilder();
  32. strSql.Append("SELECT t.* ");
  33. strSql.Append(" FROM TeacherTrain t ");
  34. strSql.Append(" WHERE 1=1 ");
  35. var queryParam = queryJson.ToJObject();
  36. // 虚拟参数
  37. var dp = new DynamicParameters(new { });
  38. if (!queryParam["EID"].IsEmpty())
  39. {
  40. dp.Add("EID", queryParam["EID"].ToString(), DbType.String);
  41. strSql.Append(" AND t.EID = @EID ");
  42. }
  43. return this.BaseRepository().FindList<TeacherTrainEntity>(strSql.ToString(), dp, pagination);
  44. }
  45. catch (Exception ex)
  46. {
  47. if (ex is ExceptionEx)
  48. {
  49. throw;
  50. }
  51. else
  52. {
  53. throw ExceptionEx.ThrowServiceException(ex);
  54. }
  55. }
  56. }
  57. /// <summary>
  58. /// 获取TeacherTrain表实体数据
  59. /// <param name="keyValue">主键</param>
  60. /// <summary>
  61. /// <returns></returns>
  62. public TeacherTrainEntity GetTeacherTrainEntity(string keyValue)
  63. {
  64. try
  65. {
  66. return this.BaseRepository().FindEntity<TeacherTrainEntity>(keyValue);
  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="queryJson">查询参数</param>
  84. /// <returns></returns>
  85. public IEnumerable<TeacherTrainEntity> GetListByEmpId(string empId)
  86. {
  87. try
  88. {
  89. return this.BaseRepository().FindList<TeacherTrainEntity>(x => x.EID == empId);
  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. /// <param name="keyValue">主键</param>
  108. /// <summary>
  109. /// <returns></returns>
  110. public void DeleteEntity(string keyValue)
  111. {
  112. try
  113. {
  114. this.BaseRepository().Delete<TeacherTrainEntity>(t => t.TTID == keyValue);
  115. }
  116. catch (Exception ex)
  117. {
  118. if (ex is ExceptionEx)
  119. {
  120. throw;
  121. }
  122. else
  123. {
  124. throw ExceptionEx.ThrowServiceException(ex);
  125. }
  126. }
  127. }
  128. /// <summary>
  129. /// 保存实体数据(新增、修改)
  130. /// <param name="keyValue">主键</param>
  131. /// <summary>
  132. /// <returns></returns>
  133. public void SaveEntity(string keyValue, TeacherTrainEntity entity)
  134. {
  135. try
  136. {
  137. if (!string.IsNullOrEmpty(keyValue))
  138. {
  139. entity.Modify(keyValue);
  140. this.BaseRepository().Update(entity);
  141. }
  142. else
  143. {
  144. entity.Create();
  145. this.BaseRepository().Insert(entity);
  146. }
  147. }
  148. catch (Exception ex)
  149. {
  150. if (ex is ExceptionEx)
  151. {
  152. throw;
  153. }
  154. else
  155. {
  156. throw ExceptionEx.ThrowServiceException(ex);
  157. }
  158. }
  159. }
  160. #endregion
  161. }
  162. }