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.

InternShipSignUpService.cs 4.8 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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:26
  15. /// 描 述:学生实习报名
  16. /// </summary>
  17. public class InternShipSignUpService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取页面显示列表数据
  22. /// <summary>
  23. /// <param name="queryJson">查询参数</param>
  24. /// <returns></returns>
  25. public IEnumerable<InternShipSignUpEntity> 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.IUnit,
  35. t.IPost,
  36. t.ITime,
  37. t.Mobile,
  38. t.Cjhecker,
  39. t.Status,
  40. t.IContent
  41. ");
  42. strSql.Append(" FROM InternShipSignUp t ");
  43. strSql.Append(" WHERE 1=1 ");
  44. var queryParam = queryJson.ToJObject();
  45. // 虚拟参数
  46. var dp = new DynamicParameters(new { });
  47. if (!queryParam["StudentID"].IsEmpty())
  48. {
  49. dp.Add("StudentID", "%" + queryParam["StudentID"].ToString() + "%", DbType.String);
  50. strSql.Append(" AND t.StudentID Like @StudentID ");
  51. }
  52. if (!queryParam["Mobile"].IsEmpty())
  53. {
  54. dp.Add("Mobile", "%" + queryParam["Mobile"].ToString() + "%", DbType.String);
  55. strSql.Append(" AND t.Mobile Like @Mobile ");
  56. }
  57. return this.BaseRepository("CollegeMIS").FindList<InternShipSignUpEntity>(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. /// 获取InternShipSignUp表实体数据
  73. /// <param name="keyValue">主键</param>
  74. /// <summary>
  75. /// <returns></returns>
  76. public InternShipSignUpEntity GetInternShipSignUpEntity(string keyValue)
  77. {
  78. try
  79. {
  80. return this.BaseRepository("CollegeMIS").FindEntity<InternShipSignUpEntity>(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. /// <param name="keyValue">主键</param>
  99. /// <summary>
  100. /// <returns></returns>
  101. public void DeleteEntity(string keyValue)
  102. {
  103. try
  104. {
  105. this.BaseRepository("CollegeMIS").Delete<InternShipSignUpEntity>(t=>t.ID == keyValue);
  106. }
  107. catch (Exception ex)
  108. {
  109. if (ex is ExceptionEx)
  110. {
  111. throw;
  112. }
  113. else
  114. {
  115. throw ExceptionEx.ThrowServiceException(ex);
  116. }
  117. }
  118. }
  119. /// <summary>
  120. /// 保存实体数据(新增、修改)
  121. /// <param name="keyValue">主键</param>
  122. /// <summary>
  123. /// <returns></returns>
  124. public void SaveEntity(string keyValue, InternShipSignUpEntity entity)
  125. {
  126. try
  127. {
  128. if (!string.IsNullOrEmpty(keyValue))
  129. {
  130. entity.Modify(keyValue);
  131. this.BaseRepository("CollegeMIS").Update(entity);
  132. }
  133. else
  134. {
  135. entity.Create();
  136. this.BaseRepository("CollegeMIS").Insert(entity);
  137. }
  138. }
  139. catch (Exception ex)
  140. {
  141. if (ex is ExceptionEx)
  142. {
  143. throw;
  144. }
  145. else
  146. {
  147. throw ExceptionEx.ThrowServiceException(ex);
  148. }
  149. }
  150. }
  151. #endregion
  152. }
  153. }