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.

BCdCultureDegreeService.cs 5.7 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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. /// 日 期:2020-06-10 12:25
  15. /// 描 述:文化程度
  16. /// </summary>
  17. public class BCdCultureDegreeService : RepositoryFactory
  18. {
  19. #region 构造函数和属性
  20. private string fieldSql;
  21. public BCdCultureDegreeService()
  22. {
  23. fieldSql = @"
  24. t.CultureDegreeNo,
  25. t.CultureDegree
  26. ";
  27. }
  28. #endregion
  29. #region 获取数据
  30. /// <summary>
  31. /// 获取列表数据
  32. /// <summary>
  33. /// <returns></returns>
  34. public IEnumerable<BCdCultureDegreeEntity> GetList(string queryJson)
  35. {
  36. try
  37. {
  38. //参考写法
  39. //var queryParam = queryJson.ToJObject();
  40. // 虚拟参数
  41. //var dp = new DynamicParameters(new { });
  42. //dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime);
  43. var strSql = new StringBuilder();
  44. strSql.Append("SELECT ");
  45. strSql.Append(fieldSql);
  46. strSql.Append(" FROM BCdCultureDegree t ");
  47. return this.BaseRepository("CollegeMIS").FindList<BCdCultureDegreeEntity>(strSql.ToString());
  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. public IEnumerable<BCdCultureDegreeEntity> GetAllList()
  62. {
  63. try
  64. {
  65. return this.BaseRepository("CollegeMIS").FindList<BCdCultureDegreeEntity>();
  66. }
  67. catch (Exception ex)
  68. {
  69. if (ex is ExceptionEx)
  70. {
  71. throw;
  72. }
  73. else
  74. {
  75. throw ExceptionEx.ThrowServiceException(ex);
  76. }
  77. }
  78. }
  79. /// <summary>
  80. /// 获取列表分页数据
  81. /// <param name="pagination">分页参数</param>
  82. /// <summary>
  83. /// <returns></returns>
  84. public IEnumerable<BCdCultureDegreeEntity> GetPageList(Pagination pagination, string queryJson)
  85. {
  86. try
  87. {
  88. var strSql = new StringBuilder();
  89. strSql.Append("SELECT ");
  90. strSql.Append(fieldSql);
  91. strSql.Append(" FROM BCdCultureDegree t ");
  92. return this.BaseRepository("CollegeMIS").FindList<BCdCultureDegreeEntity>(strSql.ToString(), pagination);
  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. /// 获取实体数据
  108. /// <param name="keyValue">主键</param>
  109. /// <summary>
  110. /// <returns></returns>
  111. public BCdCultureDegreeEntity GetEntity(string keyValue)
  112. {
  113. try
  114. {
  115. return this.BaseRepository("CollegeMIS").FindEntity<BCdCultureDegreeEntity>(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<BCdCultureDegreeEntity>(t => t.CultureDegreeNo == 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(string keyValue, BCdCultureDegreeEntity entity)
  160. {
  161. try
  162. {
  163. if (!string.IsNullOrEmpty(keyValue))
  164. {
  165. entity.Modify(keyValue);
  166. this.BaseRepository("CollegeMIS").Update(entity);
  167. }
  168. else
  169. {
  170. entity.Create();
  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. }