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.
 
 
 
 
 
 

268 lines
9.3 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 strSql = new StringBuilder();
  31. strSql.Append("select d.Id as DisciplineId,d.DisciplineTime,d.Things as DisciplineThings,d.SType,d.StuNo,d.CheckTime as DisciplineCheckTime,t.* ");
  32. strSql.Append(" from StuDisciplineManagement d ");
  33. strSql.Append(" left join StuCancelDisciplineManagement t on d.CancelId=t.Id ");
  34. strSql.Append(" WHERE 1=1 and d.CheckStatus='2' ");
  35. var queryParam = queryJson.ToJObject();
  36. // 虚拟参数
  37. var dp = new DynamicParameters(new { });
  38. if (!queryParam["StuNo"].IsEmpty())
  39. {
  40. dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String);
  41. strSql.Append(" AND d.StuNo = @StuNo ");
  42. }
  43. if (!queryParam["SType"].IsEmpty())
  44. {
  45. dp.Add("SType", queryParam["SType"].ToString(), DbType.String);
  46. strSql.Append(" AND d.SType = @SType ");
  47. }
  48. return this.BaseRepository("CollegeMIS").FindList<StuCancelDisciplineManagementEntity>(strSql.ToString(), dp, pagination);
  49. }
  50. catch (Exception ex)
  51. {
  52. if (ex is ExceptionEx)
  53. {
  54. throw;
  55. }
  56. else
  57. {
  58. throw ExceptionEx.ThrowServiceException(ex);
  59. }
  60. }
  61. }
  62. /// <summary>
  63. /// 获取页面显示列表数据
  64. /// </summary>
  65. /// <param name="pagination">分页参数</param>
  66. /// <param name="queryJson">查询参数</param>
  67. /// <returns></returns>
  68. public IEnumerable<StuCancelDisciplineManagementEntity> GetPageListOfTeacher(Pagination pagination, string queryJson)
  69. {
  70. try
  71. {
  72. var strSql = new StringBuilder();
  73. strSql.Append("select d.Id as DisciplineId,d.DisciplineTime,d.Things as DisciplineThings,d.SType,d.StuNo,d.CheckTime as DisciplineCheckTime,t.* ");
  74. strSql.Append(" from StuCancelDisciplineManagement t ");
  75. strSql.Append(" left join StuDisciplineManagement d on d.CancelId=t.Id ");
  76. strSql.Append(" WHERE 1=1 and t.CheckStatus='2' ");
  77. var queryParam = queryJson.ToJObject();
  78. // 虚拟参数
  79. var dp = new DynamicParameters(new { });
  80. if (!queryParam["StuNo"].IsEmpty())
  81. {
  82. dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String);
  83. strSql.Append(" AND d.StuNo = @StuNo ");
  84. }
  85. if (!queryParam["SType"].IsEmpty())
  86. {
  87. dp.Add("SType", queryParam["SType"].ToString(), DbType.String);
  88. strSql.Append(" AND d.SType = @SType ");
  89. }
  90. return this.BaseRepository("CollegeMIS").FindList<StuCancelDisciplineManagementEntity>(strSql.ToString(), dp, pagination);
  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. /// <summary>
  105. /// 获取StuCancelDisciplineManagement表实体数据
  106. /// </summary>
  107. /// <param name="keyValue">主键</param>
  108. /// <returns></returns>
  109. public StuCancelDisciplineManagementEntity GetStuCancelDisciplineManagementEntity(string keyValue)
  110. {
  111. try
  112. {
  113. return this.BaseRepository("CollegeMIS").FindEntity<StuCancelDisciplineManagementEntity>(keyValue);
  114. }
  115. catch (Exception ex)
  116. {
  117. if (ex is ExceptionEx)
  118. {
  119. throw;
  120. }
  121. else
  122. {
  123. throw ExceptionEx.ThrowServiceException(ex);
  124. }
  125. }
  126. }
  127. /// <summary>
  128. /// 获取主表实体数据
  129. /// </summary>
  130. /// <param name="processId">流程实例ID</param>
  131. /// <returns></returns>
  132. public StuCancelDisciplineManagementEntity GetEntityByProcessId(string processId)
  133. {
  134. try
  135. {
  136. return this.BaseRepository("CollegeMIS").FindEntity<StuCancelDisciplineManagementEntity>(t => t.ProcessId == processId);
  137. }
  138. catch (Exception ex)
  139. {
  140. if (ex is ExceptionEx)
  141. {
  142. throw;
  143. }
  144. else
  145. {
  146. throw ExceptionEx.ThrowServiceException(ex);
  147. }
  148. }
  149. }
  150. #endregion
  151. #region 提交数据
  152. /// <summary>
  153. /// 删除实体数据
  154. /// </summary>
  155. /// <param name="keyValue">主键</param>
  156. public void DeleteEntity(string keyValue)
  157. {
  158. try
  159. {
  160. this.BaseRepository("CollegeMIS").Delete<StuCancelDisciplineManagementEntity>(t => t.Id == keyValue);
  161. }
  162. catch (Exception ex)
  163. {
  164. if (ex is ExceptionEx)
  165. {
  166. throw;
  167. }
  168. else
  169. {
  170. throw ExceptionEx.ThrowServiceException(ex);
  171. }
  172. }
  173. }
  174. /// <summary>
  175. /// 保存实体数据(新增、修改)
  176. /// </summary>
  177. /// <param name="keyValue">主键</param>
  178. /// <param name="entity">实体</param>
  179. /// <returns></returns>
  180. public void SaveEntity(string keyValue, StuCancelDisciplineManagementEntity entity)
  181. {
  182. try
  183. {
  184. if (!string.IsNullOrEmpty(keyValue))
  185. {
  186. entity.Modify(keyValue);
  187. this.BaseRepository("CollegeMIS").Update(entity);
  188. }
  189. else
  190. {
  191. entity.Create();
  192. this.BaseRepository("CollegeMIS").Insert(entity);
  193. //违纪表赋值撤销违纪主键字段
  194. this.BaseRepository("CollegeMIS").ExecuteBySql($"update StuDisciplineManagement set CancelId='{entity.Id}' where Id='{entity.DisciplineId}' ");
  195. }
  196. }
  197. catch (Exception ex)
  198. {
  199. if (ex is ExceptionEx)
  200. {
  201. throw;
  202. }
  203. else
  204. {
  205. throw ExceptionEx.ThrowServiceException(ex);
  206. }
  207. }
  208. }
  209. /// <summary>
  210. /// 提交实体数据
  211. /// </summary>
  212. /// <param name="keyValue">主键</param>
  213. public void DoSubmit(string keyValue, string status, string processId)
  214. {
  215. try
  216. {
  217. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuCancelDisciplineManagement set CheckStatus='" + status + "',ProcessId='" + processId + "' where Id='" + keyValue + "' ");
  218. }
  219. catch (Exception ex)
  220. {
  221. if (ex is ExceptionEx)
  222. {
  223. throw;
  224. }
  225. else
  226. {
  227. throw ExceptionEx.ThrowServiceException(ex);
  228. }
  229. }
  230. }
  231. /// <summary>
  232. /// 审核实体数据
  233. /// </summary>
  234. /// <param name="keyValue">主键</param>
  235. public void ChangeStatusByProcessId(string status, string processId, string userId)
  236. {
  237. try
  238. {
  239. this.BaseRepository("CollegeMIS").ExecuteBySql("update StuCancelDisciplineManagement set CheckStatus='" + status + "',CheckUserId='" + userId + "',CheckTime='" + DateTime.Now + "' where ProcessId='" + processId + "' ");
  240. }
  241. catch (Exception ex)
  242. {
  243. if (ex is ExceptionEx)
  244. {
  245. throw;
  246. }
  247. else
  248. {
  249. throw ExceptionEx.ThrowServiceException(ex);
  250. }
  251. }
  252. }
  253. #endregion
  254. }
  255. }