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.

ResearchGERService.cs 4.5 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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-05-11 18:17
  15. /// 描 述:教科研组管理
  16. /// </summary>
  17. public class ResearchGERService : 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<ResearchGEREntity> GetPageList(Pagination pagination, string queryJson)
  27. {
  28. try
  29. {
  30. var strSql = new StringBuilder();
  31. strSql.Append("SELECT ");
  32. strSql.Append(@"
  33. t.GerID,
  34. t.GerName,
  35. t.GerBoss,
  36. t.Gertiem,
  37. t.GerState
  38. ");
  39. strSql.Append(" FROM ResearchGER t ");
  40. strSql.Append(" WHERE 1=1 ");
  41. var queryParam = queryJson.ToJObject();
  42. // 虚拟参数
  43. var dp = new DynamicParameters(new { });
  44. if (!queryParam["GerName"].IsEmpty())
  45. {
  46. dp.Add("GerName", "%" + queryParam["GerName"].ToString() + "%", DbType.String);
  47. strSql.Append(" AND t.GerName Like @GerName ");
  48. }
  49. return this.BaseRepository("CollegeMIS").FindList<ResearchGEREntity>(strSql.ToString(),dp, pagination);
  50. }
  51. catch (Exception ex)
  52. {
  53. if (ex is ExceptionEx)
  54. {
  55. throw;
  56. }
  57. else
  58. {
  59. throw ExceptionEx.ThrowServiceException(ex);
  60. }
  61. }
  62. }
  63. /// <summary>
  64. /// 获取ResearchGER表实体数据
  65. /// </summary>
  66. /// <param name="keyValue">主键</param>
  67. /// <returns></returns>
  68. public ResearchGEREntity GetResearchGEREntity(string keyValue)
  69. {
  70. try
  71. {
  72. return this.BaseRepository("CollegeMIS").FindEntity<ResearchGEREntity>(keyValue);
  73. }
  74. catch (Exception ex)
  75. {
  76. if (ex is ExceptionEx)
  77. {
  78. throw;
  79. }
  80. else
  81. {
  82. throw ExceptionEx.ThrowServiceException(ex);
  83. }
  84. }
  85. }
  86. #endregion
  87. #region 提交数据
  88. /// <summary>
  89. /// 删除实体数据
  90. /// </summary>
  91. /// <param name="keyValue">主键</param>
  92. public void DeleteEntity(string keyValue)
  93. {
  94. try
  95. {
  96. this.BaseRepository("CollegeMIS").Delete<ResearchGEREntity>(t=>t.GerID == keyValue);
  97. }
  98. catch (Exception ex)
  99. {
  100. if (ex is ExceptionEx)
  101. {
  102. throw;
  103. }
  104. else
  105. {
  106. throw ExceptionEx.ThrowServiceException(ex);
  107. }
  108. }
  109. }
  110. /// <summary>
  111. /// 保存实体数据(新增、修改)
  112. /// </summary>
  113. /// <param name="keyValue">主键</param>
  114. /// <param name="entity">实体</param>
  115. public void SaveEntity(string keyValue, ResearchGEREntity entity)
  116. {
  117. try
  118. {
  119. if (!string.IsNullOrEmpty(keyValue))
  120. {
  121. entity.Modify(keyValue);
  122. this.BaseRepository("CollegeMIS").Update(entity);
  123. }
  124. else
  125. {
  126. entity.Create();
  127. this.BaseRepository("CollegeMIS").Insert(entity);
  128. }
  129. }
  130. catch (Exception ex)
  131. {
  132. if (ex is ExceptionEx)
  133. {
  134. throw;
  135. }
  136. else
  137. {
  138. throw ExceptionEx.ThrowServiceException(ex);
  139. }
  140. }
  141. }
  142. #endregion
  143. }
  144. }