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.
 
 
 
 
 
 

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