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.

OpenLessonPlanOfElectiveDelService.cs 6.1 KiB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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-08-28 11:54
  15. /// 描 述:合班历史记录
  16. /// </summary>
  17. public class OpenLessonPlanOfElectiveDelService : RepositoryFactory
  18. {
  19. #region 构造函数和属性
  20. private string fieldSql;
  21. public OpenLessonPlanOfElectiveDelService()
  22. {
  23. fieldSql=@"
  24. t.Id,
  25. t.MakeDate,
  26. t.AcademicYearNo,
  27. t.Semester,
  28. t.LessonNo,
  29. t.PartCode,
  30. t.LessonName,
  31. t.LessonSortNo,
  32. t.LessonSortDetailNo,
  33. t.LessonSection,
  34. t.LessonTime,
  35. t.StudyScore,
  36. t.StartWeek,
  37. t.EndWeek,
  38. t.StartDate,
  39. t.EndDate,
  40. t.CheckStyleNo,
  41. t.ScoreRecordStyleNo,
  42. t.EmpNo,
  43. t.EmpName,
  44. t.ClassRoomNo,
  45. t.ClassRoomName,
  46. t.CheckMark,
  47. t.StuNumMax,
  48. t.StuNum,
  49. t.ModifyTime,
  50. t.ModifyUserId,
  51. t.ModifyUserName
  52. ";
  53. }
  54. #endregion
  55. #region 获取数据
  56. /// <summary>
  57. /// 获取列表数据
  58. /// <summary>
  59. /// <returns></returns>
  60. public IEnumerable<OpenLessonPlanOfElectiveDelEntity> GetList( string queryJson )
  61. {
  62. try
  63. {
  64. //参考写法
  65. //var queryParam = queryJson.ToJObject();
  66. // 虚拟参数
  67. //var dp = new DynamicParameters(new { });
  68. //dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime);
  69. var strSql = new StringBuilder();
  70. strSql.Append("SELECT ");
  71. strSql.Append(fieldSql);
  72. strSql.Append(" FROM OpenLessonPlanOfElectiveDel t ");
  73. return this.BaseRepository("CollegeMIS").FindList<OpenLessonPlanOfElectiveDelEntity>(strSql.ToString());
  74. }
  75. catch (Exception ex)
  76. {
  77. if (ex is ExceptionEx)
  78. {
  79. throw;
  80. }
  81. else
  82. {
  83. throw ExceptionEx.ThrowServiceException(ex);
  84. }
  85. }
  86. }
  87. /// <summary>
  88. /// 获取列表分页数据
  89. /// <param name="pagination">分页参数</param>
  90. /// <summary>
  91. /// <returns></returns>
  92. public IEnumerable<OpenLessonPlanOfElectiveDelEntity> GetPageList(Pagination pagination, string queryJson)
  93. {
  94. try
  95. {
  96. var strSql = new StringBuilder();
  97. strSql.Append("SELECT ");
  98. strSql.Append(fieldSql);
  99. strSql.Append(" FROM OpenLessonPlanOfElectiveDel t ");
  100. return this.BaseRepository("CollegeMIS").FindList<OpenLessonPlanOfElectiveDelEntity>(strSql.ToString(), pagination);
  101. }
  102. catch (Exception ex)
  103. {
  104. if (ex is ExceptionEx)
  105. {
  106. throw;
  107. }
  108. else
  109. {
  110. throw ExceptionEx.ThrowServiceException(ex);
  111. }
  112. }
  113. }
  114. /// <summary>
  115. /// 获取实体数据
  116. /// <param name="keyValue">主键</param>
  117. /// <summary>
  118. /// <returns></returns>
  119. public OpenLessonPlanOfElectiveDelEntity GetEntity(string keyValue)
  120. {
  121. try
  122. {
  123. return this.BaseRepository("CollegeMIS").FindEntity<OpenLessonPlanOfElectiveDelEntity>(keyValue);
  124. }
  125. catch (Exception ex)
  126. {
  127. if (ex is ExceptionEx)
  128. {
  129. throw;
  130. }
  131. else
  132. {
  133. throw ExceptionEx.ThrowServiceException(ex);
  134. }
  135. }
  136. }
  137. #endregion
  138. #region 提交数据
  139. /// <summary>
  140. /// 删除实体数据
  141. /// <param name="keyValue">主键</param>
  142. /// <summary>
  143. /// <returns></returns>
  144. public void DeleteEntity(string keyValue)
  145. {
  146. try
  147. {
  148. this.BaseRepository("CollegeMIS").Delete<OpenLessonPlanOfElectiveDelEntity>(t=>t.Id == keyValue);
  149. }
  150. catch (Exception ex)
  151. {
  152. if (ex is ExceptionEx)
  153. {
  154. throw;
  155. }
  156. else
  157. {
  158. throw ExceptionEx.ThrowServiceException(ex);
  159. }
  160. }
  161. }
  162. /// <summary>
  163. /// 保存实体数据(新增、修改)
  164. /// <param name="keyValue">主键</param>
  165. /// <summary>
  166. /// <returns></returns>
  167. public void SaveEntity(string keyValue, OpenLessonPlanOfElectiveDelEntity entity)
  168. {
  169. try
  170. {
  171. if (!string.IsNullOrEmpty(keyValue))
  172. {
  173. entity.Modify(keyValue);
  174. this.BaseRepository("CollegeMIS").Update(entity);
  175. }
  176. else
  177. {
  178. entity.Create();
  179. this.BaseRepository("CollegeMIS").Insert(entity);
  180. }
  181. }
  182. catch (Exception ex)
  183. {
  184. if (ex is ExceptionEx)
  185. {
  186. throw;
  187. }
  188. else
  189. {
  190. throw ExceptionEx.ThrowServiceException(ex);
  191. }
  192. }
  193. }
  194. #endregion
  195. }
  196. }