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.

TextBookIndentDetailService.cs 5.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  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 V7.0.6 力软敏捷开发框架
  12. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2022-02-27 09:35
  15. /// 描 述:TextBookIndentDetail
  16. /// </summary>
  17. public class TextBookIndentDetailService : RepositoryFactory
  18. {
  19. #region 构造函数和属性
  20. private string fieldSql;
  21. /// <summary>
  22. /// 构造方法
  23. /// </summary>
  24. public TextBookIndentDetailService()
  25. {
  26. fieldSql = @"
  27. t.ID,
  28. t.IndentId,
  29. t.DeptNo,
  30. t.MajorNo,
  31. t.ClassNo,
  32. t.TeachSum,
  33. t.StuSum,
  34. t.Price,
  35. t.BookNo,
  36. t.BooName,
  37. t.PublishNo,
  38. t.Remark,
  39. t.CreateTime,
  40. t.CreateUserID,
  41. t.LessonNo
  42. ";
  43. }
  44. #endregion
  45. #region 获取数据
  46. /// <summary>
  47. /// 获取列表数据
  48. /// </summary>
  49. /// <param name="queryJson">条件参数</param>
  50. /// <returns></returns>
  51. public IEnumerable<TextBookIndentDetailEntity> GetList(string queryJson)
  52. {
  53. try
  54. {
  55. //参考写法
  56. //var queryParam = queryJson.ToJObject();
  57. // 虚拟参数
  58. //var dp = new DynamicParameters(new { });
  59. //dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime);
  60. var strSql = new StringBuilder();
  61. strSql.Append("SELECT ");
  62. strSql.Append(fieldSql);
  63. strSql.Append(" FROM TextBookIndentDetail t ");
  64. return this.BaseRepository("CollegeMIS").FindList<TextBookIndentDetailEntity>(strSql.ToString());
  65. }
  66. catch (Exception ex)
  67. {
  68. if (ex is ExceptionEx)
  69. {
  70. throw;
  71. }
  72. else
  73. {
  74. throw ExceptionEx.ThrowServiceException(ex);
  75. }
  76. }
  77. }
  78. /// <summary>
  79. /// 获取列表分页数据
  80. /// </summary>
  81. /// <param name="pagination">分页参数</param>
  82. /// <param name="queryJson">条件参数</param>
  83. /// <returns></returns>
  84. public IEnumerable<TextBookIndentDetailEntity> 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 TextBookIndentDetail t ");
  92. return this.BaseRepository("CollegeMIS").FindList<TextBookIndentDetailEntity>(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. /// </summary>
  109. /// <param name="keyValue">主键</param>
  110. /// <returns></returns>
  111. public TextBookIndentDetailEntity GetEntity(string keyValue)
  112. {
  113. try
  114. {
  115. return this.BaseRepository("CollegeMIS").FindEntity<TextBookIndentDetailEntity>(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. /// </summary>
  134. /// <param name="keyValue">主键</param>
  135. public void DeleteEntity(string keyValue)
  136. {
  137. try
  138. {
  139. this.BaseRepository("CollegeMIS").Delete<TextBookIndentDetailEntity>(t => t.ID == keyValue);
  140. }
  141. catch (Exception ex)
  142. {
  143. if (ex is ExceptionEx)
  144. {
  145. throw;
  146. }
  147. else
  148. {
  149. throw ExceptionEx.ThrowServiceException(ex);
  150. }
  151. }
  152. }
  153. /// <summary>
  154. /// 保存实体数据(新增、修改)
  155. /// <param name="keyValue">主键</param>
  156. /// <param name="entity">实体</param>
  157. /// </summary>
  158. public void SaveEntity(string keyValue, TextBookIndentDetailEntity entity)
  159. {
  160. try
  161. {
  162. if (!string.IsNullOrEmpty(keyValue))
  163. {
  164. entity.Modify(keyValue);
  165. this.BaseRepository("CollegeMIS").Update(entity);
  166. }
  167. else
  168. {
  169. entity.Create();
  170. this.BaseRepository("CollegeMIS").Insert(entity);
  171. }
  172. }
  173. catch (Exception ex)
  174. {
  175. if (ex is ExceptionEx)
  176. {
  177. throw;
  178. }
  179. else
  180. {
  181. throw ExceptionEx.ThrowServiceException(ex);
  182. }
  183. }
  184. }
  185. #endregion
  186. }
  187. }