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.
 
 
 
 
 
 

200 lines
6.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 V7.0.6 力软敏捷开发框架
  12. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2023-03-16 11:49
  15. /// 描 述:校级奖学金
  16. /// </summary>
  17. public class SchoolLevelScholarshipService : 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<SchoolLevelScholarshipEntity> GetPageList(Pagination pagination, string queryJson)
  27. {
  28. try
  29. {
  30. var strSql = new StringBuilder();
  31. strSql.Append("SELECT ");
  32. strSql.Append(@"
  33. t.Id,
  34. t.StuNo,
  35. t.StuName,
  36. t.DeptNo,
  37. t.ClassNo,
  38. t.IdCardType,
  39. t.IdCard,
  40. t.CalssNum,
  41. t.ClassRank,
  42. t.FundingLevel,
  43. t.FundingCriteria,
  44. t.ShoudAmount,
  45. t.ActualAmount,
  46. t.ApplyDate,
  47. t.ProvideDate,
  48. t.ApplyAccount,
  49. t.DepositBank,
  50. t.BankCard,
  51. t.BankCode,
  52. t.Remark,
  53. t.Url
  54. ");
  55. strSql.Append(" FROM SchoolLevelScholarship t ");
  56. strSql.Append(" WHERE 1=1 ");
  57. var queryParam = queryJson.ToJObject();
  58. // 虚拟参数
  59. var dp = new DynamicParameters(new { });
  60. if (!queryParam["ApplyDate"].IsEmpty())
  61. {
  62. dp.Add("ApplyDate",queryParam["ApplyDate"].ToString(), DbType.String);
  63. strSql.Append(" AND t.ApplyDate = @ApplyDate ");
  64. }
  65. if (!queryParam["ProvideDate"].IsEmpty())
  66. {
  67. dp.Add("ProvideDate",queryParam["ProvideDate"].ToString(), DbType.String);
  68. strSql.Append(" AND t.ProvideDate = @ProvideDate ");
  69. }
  70. if (!queryParam["DeptNo"].IsEmpty())
  71. {
  72. dp.Add("DeptNo",queryParam["DeptNo"].ToString(), DbType.String);
  73. strSql.Append(" AND t.DeptNo = @DeptNo ");
  74. }
  75. if (!queryParam["ClassNo"].IsEmpty())
  76. {
  77. dp.Add("ClassNo",queryParam["ClassNo"].ToString(), DbType.String);
  78. strSql.Append(" AND t.ClassNo = @ClassNo ");
  79. }
  80. if (!queryParam["IdCard"].IsEmpty())
  81. {
  82. dp.Add("IdCard", "%" + queryParam["IdCard"].ToString() + "%", DbType.String);
  83. strSql.Append(" AND t.IdCard Like @IdCard ");
  84. }
  85. if (!queryParam["FundingLevel"].IsEmpty())
  86. {
  87. dp.Add("FundingLevel",queryParam["FundingLevel"].ToString(), DbType.String);
  88. strSql.Append(" AND t.FundingLevel = @FundingLevel ");
  89. }
  90. if (!queryParam["BankCard"].IsEmpty())
  91. {
  92. dp.Add("BankCard", "%" + queryParam["BankCard"].ToString() + "%", DbType.String);
  93. strSql.Append(" AND t.BankCard Like @BankCard ");
  94. }
  95. return this.BaseRepository("CollegeMIS").FindList<SchoolLevelScholarshipEntity>(strSql.ToString(),dp, pagination);
  96. }
  97. catch (Exception ex)
  98. {
  99. if (ex is ExceptionEx)
  100. {
  101. throw;
  102. }
  103. else
  104. {
  105. throw ExceptionEx.ThrowServiceException(ex);
  106. }
  107. }
  108. }
  109. /// <summary>
  110. /// 获取SchoolLevelScholarship表实体数据
  111. /// </summary>
  112. /// <param name="keyValue">主键</param>
  113. /// <returns></returns>
  114. public SchoolLevelScholarshipEntity GetSchoolLevelScholarshipEntity(string keyValue)
  115. {
  116. try
  117. {
  118. return this.BaseRepository("CollegeMIS").FindEntity<SchoolLevelScholarshipEntity>(keyValue);
  119. }
  120. catch (Exception ex)
  121. {
  122. if (ex is ExceptionEx)
  123. {
  124. throw;
  125. }
  126. else
  127. {
  128. throw ExceptionEx.ThrowServiceException(ex);
  129. }
  130. }
  131. }
  132. #endregion
  133. #region 提交数据
  134. /// <summary>
  135. /// 删除实体数据
  136. /// </summary>
  137. /// <param name="keyValue">主键</param>
  138. public void DeleteEntity(string keyValue)
  139. {
  140. try
  141. {
  142. this.BaseRepository("CollegeMIS").Delete<SchoolLevelScholarshipEntity>(t=>t.Id == keyValue);
  143. }
  144. catch (Exception ex)
  145. {
  146. if (ex is ExceptionEx)
  147. {
  148. throw;
  149. }
  150. else
  151. {
  152. throw ExceptionEx.ThrowServiceException(ex);
  153. }
  154. }
  155. }
  156. /// <summary>
  157. /// 保存实体数据(新增、修改)
  158. /// </summary>
  159. /// <param name="keyValue">主键</param>
  160. /// <param name="entity">实体</param>
  161. public void SaveEntity(string keyValue, SchoolLevelScholarshipEntity entity)
  162. {
  163. try
  164. {
  165. if (!string.IsNullOrEmpty(keyValue))
  166. {
  167. entity.Modify(keyValue);
  168. this.BaseRepository("CollegeMIS").Update(entity);
  169. }
  170. else
  171. {
  172. entity.Create();
  173. this.BaseRepository("CollegeMIS").Insert(entity);
  174. }
  175. }
  176. catch (Exception ex)
  177. {
  178. if (ex is ExceptionEx)
  179. {
  180. throw;
  181. }
  182. else
  183. {
  184. throw ExceptionEx.ThrowServiceException(ex);
  185. }
  186. }
  187. }
  188. #endregion
  189. }
  190. }