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.
 
 
 
 
 
 

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