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.
 
 
 
 
 
 

224 lines
7.1 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 StuDisciplineManagementService : 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<StuDisciplineManagementEntity> 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 StuDisciplineManagement 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["StuNo"].IsEmpty())
  40. {
  41. dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String);
  42. strSql.Append(" AND t.StuNo = @StuNo ");
  43. }
  44. if (!queryParam["EmpNo"].IsEmpty())
  45. {
  46. dp.Add("EmpNo", queryParam["EmpNo"].ToString(), DbType.String);
  47. strSql.Append(" and t.EmpNo = @EmpNo ");
  48. }
  49. return this.BaseRepository("CollegeMIS").FindList<StuDisciplineManagementEntity>(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. /// 获取StuDisciplineManagement表实体数据
  65. /// </summary>
  66. /// <param name="keyValue">主键</param>
  67. /// <returns></returns>
  68. public StuDisciplineManagementEntity GetStuDisciplineManagementEntity(string keyValue)
  69. {
  70. try
  71. {
  72. return this.BaseRepository("CollegeMIS").FindEntity<StuDisciplineManagementEntity>(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. /// <summary>
  87. /// 获取主表实体数据
  88. /// </summary>
  89. /// <param name="processId">流程实例ID</param>
  90. /// <returns></returns>
  91. public StuDisciplineManagementEntity GetEntityByProcessId(string processId)
  92. {
  93. try
  94. {
  95. return this.BaseRepository("CollegeMIS").FindEntity<StuDisciplineManagementEntity>(t => t.ProcessId == processId);
  96. }
  97. catch (Exception ex)
  98. {
  99. if (ex is ExceptionEx)
  100. {
  101. throw;
  102. }
  103. else
  104. {
  105. throw ExceptionEx.ThrowServiceException(ex);
  106. }
  107. }
  108. }
  109. #endregion
  110. #region 提交数据
  111. /// <summary>
  112. /// 删除实体数据
  113. /// </summary>
  114. /// <param name="keyValue">主键</param>
  115. public void DeleteEntity(string keyValue)
  116. {
  117. try
  118. {
  119. this.BaseRepository("CollegeMIS").Delete<StuDisciplineManagementEntity>(t => t.Id == keyValue);
  120. }
  121. catch (Exception ex)
  122. {
  123. if (ex is ExceptionEx)
  124. {
  125. throw;
  126. }
  127. else
  128. {
  129. throw ExceptionEx.ThrowServiceException(ex);
  130. }
  131. }
  132. }
  133. /// <summary>
  134. /// 保存实体数据(新增、修改)
  135. /// </summary>
  136. /// <param name="keyValue">主键</param>
  137. /// <param name="entity">实体</param>
  138. /// <returns></returns>
  139. public void SaveEntity(string keyValue, StuDisciplineManagementEntity entity)
  140. {
  141. try
  142. {
  143. if (!string.IsNullOrEmpty(keyValue))
  144. {
  145. entity.Modify(keyValue);
  146. this.BaseRepository("CollegeMIS").Update(entity);
  147. }
  148. else
  149. {
  150. entity.Create();
  151. this.BaseRepository("CollegeMIS").Insert(entity);
  152. }
  153. }
  154. catch (Exception ex)
  155. {
  156. if (ex is ExceptionEx)
  157. {
  158. throw;
  159. }
  160. else
  161. {
  162. throw ExceptionEx.ThrowServiceException(ex);
  163. }
  164. }
  165. }
  166. /// <summary>
  167. /// 提交实体数据
  168. /// </summary>
  169. /// <param name="keyValue">主键</param>
  170. public void DoSubmit(string keyValue, string status, string processId)
  171. {
  172. try
  173. {
  174. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuDisciplineManagement set CheckStatus='" + status + "',ProcessId='" + processId + "' where Id='" + keyValue + "' ");
  175. }
  176. catch (Exception ex)
  177. {
  178. if (ex is ExceptionEx)
  179. {
  180. throw;
  181. }
  182. else
  183. {
  184. throw ExceptionEx.ThrowServiceException(ex);
  185. }
  186. }
  187. }
  188. /// <summary>
  189. /// 审核实体数据
  190. /// </summary>
  191. /// <param name="keyValue">主键</param>
  192. public void ChangeStatusByProcessId(string status, string processId, string userId)
  193. {
  194. try
  195. {
  196. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuDisciplineManagement set CheckStatus='" + status + "',CheckUserId='" + userId + "',CheckTime='" + DateTime.Now + "' where ProcessId='" + processId + "' ");
  197. }
  198. catch (Exception ex)
  199. {
  200. if (ex is ExceptionEx)
  201. {
  202. throw;
  203. }
  204. else
  205. {
  206. throw ExceptionEx.ThrowServiceException(ex);
  207. }
  208. }
  209. }
  210. #endregion
  211. }
  212. }