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.
 
 
 
 
 
 

153 lines
4.2 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.PersonnelManagement
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2020-02-10 16:32
  15. /// 描 述:疫情经过记录
  16. /// </summary>
  17. public class EpiPassPlaceService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取页面显示列表数据
  22. /// <summary>
  23. /// <param name="queryJson">查询参数</param>
  24. /// <returns></returns>
  25. public IEnumerable<PassPlaceEntity> 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.PassType,
  34. t.Time,
  35. t.Vehicle,
  36. t.VehicleNo,
  37. t.Province,
  38. t.Area,
  39. t.City,
  40. t.EID
  41. ");
  42. strSql.Append(" FROM PassPlace t ");
  43. strSql.Append(" WHERE 1=1 ");
  44. var queryParam = queryJson.ToJObject();
  45. // 虚拟参数
  46. var dp = new DynamicParameters(new { });
  47. return this.BaseRepository("CollegeMIS").FindList<PassPlaceEntity>(strSql.ToString(),dp, pagination);
  48. }
  49. catch (Exception ex)
  50. {
  51. if (ex is ExceptionEx)
  52. {
  53. throw;
  54. }
  55. else
  56. {
  57. throw ExceptionEx.ThrowServiceException(ex);
  58. }
  59. }
  60. }
  61. /// <summary>
  62. /// 获取PassPlace表实体数据
  63. /// <param name="keyValue">主键</param>
  64. /// <summary>
  65. /// <returns></returns>
  66. public PassPlaceEntity GetPassPlaceEntity(string keyValue)
  67. {
  68. try
  69. {
  70. return this.BaseRepository("CollegeMIS").FindEntity<PassPlaceEntity>(keyValue);
  71. }
  72. catch (Exception ex)
  73. {
  74. if (ex is ExceptionEx)
  75. {
  76. throw;
  77. }
  78. else
  79. {
  80. throw ExceptionEx.ThrowServiceException(ex);
  81. }
  82. }
  83. }
  84. #endregion
  85. #region 提交数据
  86. /// <summary>
  87. /// 删除实体数据
  88. /// <param name="keyValue">主键</param>
  89. /// <summary>
  90. /// <returns></returns>
  91. public void DeleteEntity(string keyValue)
  92. {
  93. try
  94. {
  95. this.BaseRepository("CollegeMIS").Delete<PassPlaceEntity>(t=>t.ID == keyValue);
  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. /// 保存实体数据(新增、修改)
  111. /// <param name="keyValue">主键</param>
  112. /// <summary>
  113. /// <returns></returns>
  114. public void SaveEntity(string keyValue, PassPlaceEntity entity)
  115. {
  116. try
  117. {
  118. if (!string.IsNullOrEmpty(keyValue))
  119. {
  120. entity.Modify(keyValue);
  121. this.BaseRepository("CollegeMIS").Update(entity);
  122. }
  123. else
  124. {
  125. entity.Create();
  126. this.BaseRepository("CollegeMIS").Insert(entity);
  127. }
  128. }
  129. catch (Exception ex)
  130. {
  131. if (ex is ExceptionEx)
  132. {
  133. throw;
  134. }
  135. else
  136. {
  137. throw ExceptionEx.ThrowServiceException(ex);
  138. }
  139. }
  140. }
  141. #endregion
  142. }
  143. }