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.
 
 
 
 
 
 

164 lines
4.9 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-12-11 11:48
  15. /// 描 述:请假列表
  16. /// </summary>
  17. public class LeaveSchoolAService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取页面显示列表数据
  22. /// <summary>
  23. /// <param name="queryJson">查询参数</param>
  24. /// <returns></returns>
  25. public IEnumerable<LeaveSchoolEntity> 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.F_ShenQinRen,
  34. t.F_StartTime,
  35. t.F_EndTime,
  36. t.F_YuanYou,t.F_leixing
  37. ");
  38. strSql.Append(" FROM LeaveSchool t ");
  39. strSql.Append(" WHERE 1=1 ");
  40. var queryParam = queryJson.ToJObject();
  41. // 虚拟参数
  42. var dp = new DynamicParameters(new { });
  43. if (!queryParam["F_StartTime"].IsEmpty())
  44. {
  45. dp.Add("F_StartTime",queryParam["F_StartTime"].ToString(), DbType.String);
  46. strSql.Append(" AND t.F_StartTime >= @F_StartTime ");
  47. }
  48. if (!queryParam["F_EndTime"].IsEmpty())
  49. {
  50. dp.Add("F_EndTime",queryParam["F_EndTime"].ToString(), DbType.String);
  51. strSql.Append(" AND t.F_EndTime <= @F_EndTime ");
  52. }
  53. if (!queryParam["F_leixing"].IsEmpty())
  54. {
  55. dp.Add("F_leixing", queryParam["F_leixing"].ToString(), DbType.String);
  56. strSql.Append(" AND t.F_leixing = @F_leixing ");
  57. }
  58. return this.BaseRepository().FindList<LeaveSchoolEntity>(strSql.ToString(),dp, pagination);
  59. }
  60. catch (Exception ex)
  61. {
  62. if (ex is ExceptionEx)
  63. {
  64. throw;
  65. }
  66. else
  67. {
  68. throw ExceptionEx.ThrowServiceException(ex);
  69. }
  70. }
  71. }
  72. /// <summary>
  73. /// 获取LeaveSchool表实体数据
  74. /// <param name="keyValue">主键</param>
  75. /// <summary>
  76. /// <returns></returns>
  77. public LeaveSchoolEntity GetLeaveSchoolEntity(string keyValue)
  78. {
  79. try
  80. {
  81. return this.BaseRepository().FindEntity<LeaveSchoolEntity>(keyValue);
  82. }
  83. catch (Exception ex)
  84. {
  85. if (ex is ExceptionEx)
  86. {
  87. throw;
  88. }
  89. else
  90. {
  91. throw ExceptionEx.ThrowServiceException(ex);
  92. }
  93. }
  94. }
  95. #endregion
  96. #region 提交数据
  97. /// <summary>
  98. /// 删除实体数据
  99. /// <param name="keyValue">主键</param>
  100. /// <summary>
  101. /// <returns></returns>
  102. public void DeleteEntity(string keyValue)
  103. {
  104. try
  105. {
  106. this.BaseRepository().Delete<LeaveSchoolEntity>(t=>t.ID == keyValue);
  107. }
  108. catch (Exception ex)
  109. {
  110. if (ex is ExceptionEx)
  111. {
  112. throw;
  113. }
  114. else
  115. {
  116. throw ExceptionEx.ThrowServiceException(ex);
  117. }
  118. }
  119. }
  120. /// <summary>
  121. /// 保存实体数据(新增、修改)
  122. /// <param name="keyValue">主键</param>
  123. /// <summary>
  124. /// <returns></returns>
  125. public void SaveEntity(string keyValue, LeaveSchoolEntity entity)
  126. {
  127. try
  128. {
  129. if (!string.IsNullOrEmpty(keyValue))
  130. {
  131. entity.Modify(keyValue);
  132. this.BaseRepository().Update(entity);
  133. }
  134. else
  135. {
  136. entity.Create();
  137. this.BaseRepository().Insert(entity);
  138. }
  139. }
  140. catch (Exception ex)
  141. {
  142. if (ex is ExceptionEx)
  143. {
  144. throw;
  145. }
  146. else
  147. {
  148. throw ExceptionEx.ThrowServiceException(ex);
  149. }
  150. }
  151. }
  152. #endregion
  153. }
  154. }