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.
 
 
 
 
 
 

219 lines
6.9 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.EducationalAdministration
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架
  12. /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2021-04-14 11:52
  15. /// 描 述:学生撤销违纪管理
  16. /// </summary>
  17. public class StuCancelDisciplineManagementService : 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<StuCancelDisciplineManagementEntity> GetPageList(Pagination pagination, string queryJson)
  27. {
  28. try
  29. {
  30. var basedbname = BaseRepository().getDbConnection().Database;
  31. var strSql = new StringBuilder();
  32. strSql.Append("SELECT t.* ");
  33. strSql.Append(" FROM StuCancelDisciplineManagement t ");
  34. strSql.Append(" left join " + basedbname + ".dbo.LR_Base_User u on t.CreateUserId=u.F_UserId ");
  35. strSql.Append(" WHERE 1=1 ");
  36. var queryParam = queryJson.ToJObject();
  37. // 虚拟参数
  38. var dp = new DynamicParameters(new { });
  39. if (!queryParam["StuName"].IsEmpty())
  40. {
  41. dp.Add("StuName", "%" + queryParam["StuName"].ToString() + "%", DbType.String);
  42. strSql.Append(" AND u.F_RealName like @StuName ");
  43. }
  44. return this.BaseRepository("CollegeMIS").FindList<StuCancelDisciplineManagementEntity>(strSql.ToString(), dp, pagination);
  45. }
  46. catch (Exception ex)
  47. {
  48. if (ex is ExceptionEx)
  49. {
  50. throw;
  51. }
  52. else
  53. {
  54. throw ExceptionEx.ThrowServiceException(ex);
  55. }
  56. }
  57. }
  58. /// <summary>
  59. /// 获取StuCancelDisciplineManagement表实体数据
  60. /// </summary>
  61. /// <param name="keyValue">主键</param>
  62. /// <returns></returns>
  63. public StuCancelDisciplineManagementEntity GetStuCancelDisciplineManagementEntity(string keyValue)
  64. {
  65. try
  66. {
  67. return this.BaseRepository("CollegeMIS").FindEntity<StuCancelDisciplineManagementEntity>(keyValue);
  68. }
  69. catch (Exception ex)
  70. {
  71. if (ex is ExceptionEx)
  72. {
  73. throw;
  74. }
  75. else
  76. {
  77. throw ExceptionEx.ThrowServiceException(ex);
  78. }
  79. }
  80. }
  81. /// <summary>
  82. /// 获取主表实体数据
  83. /// </summary>
  84. /// <param name="processId">流程实例ID</param>
  85. /// <returns></returns>
  86. public StuCancelDisciplineManagementEntity GetEntityByProcessId(string processId)
  87. {
  88. try
  89. {
  90. return this.BaseRepository("CollegeMIS").FindEntity<StuCancelDisciplineManagementEntity>(t => t.ProcessId == processId);
  91. }
  92. catch (Exception ex)
  93. {
  94. if (ex is ExceptionEx)
  95. {
  96. throw;
  97. }
  98. else
  99. {
  100. throw ExceptionEx.ThrowServiceException(ex);
  101. }
  102. }
  103. }
  104. #endregion
  105. #region 提交数据
  106. /// <summary>
  107. /// 删除实体数据
  108. /// </summary>
  109. /// <param name="keyValue">主键</param>
  110. public void DeleteEntity(string keyValue)
  111. {
  112. try
  113. {
  114. this.BaseRepository("CollegeMIS").Delete<StuCancelDisciplineManagementEntity>(t => t.Id == keyValue);
  115. }
  116. catch (Exception ex)
  117. {
  118. if (ex is ExceptionEx)
  119. {
  120. throw;
  121. }
  122. else
  123. {
  124. throw ExceptionEx.ThrowServiceException(ex);
  125. }
  126. }
  127. }
  128. /// <summary>
  129. /// 保存实体数据(新增、修改)
  130. /// </summary>
  131. /// <param name="keyValue">主键</param>
  132. /// <param name="entity">实体</param>
  133. /// <returns></returns>
  134. public void SaveEntity(string keyValue, StuCancelDisciplineManagementEntity entity)
  135. {
  136. try
  137. {
  138. if (!string.IsNullOrEmpty(keyValue))
  139. {
  140. entity.Modify(keyValue);
  141. this.BaseRepository("CollegeMIS").Update(entity);
  142. }
  143. else
  144. {
  145. entity.Create();
  146. this.BaseRepository("CollegeMIS").Insert(entity);
  147. }
  148. }
  149. catch (Exception ex)
  150. {
  151. if (ex is ExceptionEx)
  152. {
  153. throw;
  154. }
  155. else
  156. {
  157. throw ExceptionEx.ThrowServiceException(ex);
  158. }
  159. }
  160. }
  161. /// <summary>
  162. /// 提交实体数据
  163. /// </summary>
  164. /// <param name="keyValue">主键</param>
  165. public void DoSubmit(string keyValue, string status, string processId)
  166. {
  167. try
  168. {
  169. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuCancelDisciplineManagement set CheckStatus='" + status + "',ProcessId='" + processId + "' where Id='" + keyValue + "' ");
  170. }
  171. catch (Exception ex)
  172. {
  173. if (ex is ExceptionEx)
  174. {
  175. throw;
  176. }
  177. else
  178. {
  179. throw ExceptionEx.ThrowServiceException(ex);
  180. }
  181. }
  182. }
  183. /// <summary>
  184. /// 审核实体数据
  185. /// </summary>
  186. /// <param name="keyValue">主键</param>
  187. public void ChangeStatusByProcessId(string status, string processId, string userId)
  188. {
  189. try
  190. {
  191. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuCancelDisciplineManagement set CheckStatus='" + status + "',CheckUserId='" + userId + "',CheckTime='" + DateTime.Now + "' where ProcessId='" + processId + "' ");
  192. }
  193. catch (Exception ex)
  194. {
  195. if (ex is ExceptionEx)
  196. {
  197. throw;
  198. }
  199. else
  200. {
  201. throw ExceptionEx.ThrowServiceException(ex);
  202. }
  203. }
  204. }
  205. #endregion
  206. }
  207. }