Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

181 Zeilen
5.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. /// 日 期:2020-05-06 11:28
  15. /// 描 述:培训报名
  16. /// </summary>
  17. public class SignUpAboutTrainService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取页面显示列表数据
  22. /// <summary>
  23. /// <param name="queryJson">查询参数</param>
  24. /// <returns></returns>
  25. public IEnumerable<SignUpAboutTrainEntity> GetPageList(Pagination pagination, string queryJson)
  26. {
  27. try
  28. {
  29. var strSql = new StringBuilder();
  30. strSql.Append("SELECT t.* ");
  31. strSql.Append(" FROM SignUpAboutTrain t ");
  32. strSql.Append(" WHERE 1=1 ");
  33. var queryParam = queryJson.ToJObject();
  34. // 虚拟参数
  35. var dp = new DynamicParameters(new { });
  36. if (!queryParam["RealName"].IsEmpty())
  37. {
  38. dp.Add("RealName", "%" + queryParam["RealName"].ToString() + "%", DbType.String);
  39. strSql.Append(" AND t.RealName Like @RealName ");
  40. }
  41. if (!queryParam["IdCard"].IsEmpty())
  42. {
  43. dp.Add("IdCard", "%" + queryParam["IdCard"].ToString() + "%", DbType.String);
  44. strSql.Append(" AND t.IdCard Like @IdCard ");
  45. }
  46. if (!queryParam["MajorNo"].IsEmpty())
  47. {
  48. dp.Add("MajorNo",queryParam["MajorNo"].ToString(), DbType.String);
  49. strSql.Append(" AND t.MajorNo = @MajorNo ");
  50. }
  51. return this.BaseRepository("CollegeMIS").FindList<SignUpAboutTrainEntity>(strSql.ToString(),dp, pagination);
  52. }
  53. catch (Exception ex)
  54. {
  55. if (ex is ExceptionEx)
  56. {
  57. throw;
  58. }
  59. else
  60. {
  61. throw ExceptionEx.ThrowServiceException(ex);
  62. }
  63. }
  64. }
  65. /// <summary>
  66. /// 获取SignUpAboutTrain表实体数据
  67. /// <param name="keyValue">主键</param>
  68. /// <summary>
  69. /// <returns></returns>
  70. public SignUpAboutTrainEntity GetSignUpAboutTrainEntity(string keyValue)
  71. {
  72. try
  73. {
  74. return this.BaseRepository("CollegeMIS").FindEntity<SignUpAboutTrainEntity>(keyValue);
  75. }
  76. catch (Exception ex)
  77. {
  78. if (ex is ExceptionEx)
  79. {
  80. throw;
  81. }
  82. else
  83. {
  84. throw ExceptionEx.ThrowServiceException(ex);
  85. }
  86. }
  87. }
  88. /// <summary>
  89. /// 获取SignUpAboutTrain表实体数据
  90. /// <param name="keyValue">主键</param>
  91. /// <summary>
  92. /// <returns></returns>
  93. public SignUpAboutTrainEntity GetSignUpAboutTrainEntityByIdCard(string idCard)
  94. {
  95. try
  96. {
  97. return this.BaseRepository("CollegeMIS").FindEntity<SignUpAboutTrainEntity>(x => x.IdCard == idCard);
  98. }
  99. catch (Exception ex)
  100. {
  101. if (ex is ExceptionEx)
  102. {
  103. throw;
  104. }
  105. else
  106. {
  107. throw ExceptionEx.ThrowServiceException(ex);
  108. }
  109. }
  110. }
  111. #endregion
  112. #region 提交数据
  113. /// <summary>
  114. /// 删除实体数据
  115. /// <param name="keyValue">主键</param>
  116. /// <summary>
  117. /// <returns></returns>
  118. public void DeleteEntity(string keyValue)
  119. {
  120. try
  121. {
  122. this.BaseRepository("CollegeMIS").Delete<SignUpAboutTrainEntity>(t=>t.Id == keyValue);
  123. }
  124. catch (Exception ex)
  125. {
  126. if (ex is ExceptionEx)
  127. {
  128. throw;
  129. }
  130. else
  131. {
  132. throw ExceptionEx.ThrowServiceException(ex);
  133. }
  134. }
  135. }
  136. /// <summary>
  137. /// 保存实体数据(新增、修改)
  138. /// <param name="keyValue">主键</param>
  139. /// <summary>
  140. /// <returns></returns>
  141. public void SaveEntity(string keyValue, SignUpAboutTrainEntity entity)
  142. {
  143. try
  144. {
  145. if (!string.IsNullOrEmpty(keyValue))
  146. {
  147. entity.Modify(keyValue);
  148. this.BaseRepository("CollegeMIS").Update(entity);
  149. }
  150. else
  151. {
  152. entity.Create();
  153. this.BaseRepository("CollegeMIS").Insert(entity);
  154. }
  155. }
  156. catch (Exception ex)
  157. {
  158. if (ex is ExceptionEx)
  159. {
  160. throw;
  161. }
  162. else
  163. {
  164. throw ExceptionEx.ThrowServiceException(ex);
  165. }
  166. }
  167. }
  168. #endregion
  169. }
  170. }