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.
 
 
 
 
 
 

149 rivejä
4.2 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.PersonnelManagement
  9. {
  10. /// <summary>
  11. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  12. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  13. /// 创 建:超级管理员
  14. /// 日 期:2019-11-19 15:30
  15. /// 描 述:值班安排
  16. /// </summary>
  17. public class DutyScheduleService : RepositoryFactory
  18. {
  19. #region 获取数据
  20. /// <summary>
  21. /// 获取页面显示列表数据
  22. /// <summary>
  23. /// <param name="queryJson">查询参数</param>
  24. /// <returns></returns>
  25. public IEnumerable<DutyScheduleEntity> GetPageList(Pagination pagination, string queryJson)
  26. {
  27. try
  28. {
  29. var strSql = new StringBuilder();
  30. strSql.Append("SELECT ");
  31. strSql.Append(@"
  32. t.ID,
  33. t.StartTime,
  34. t.EndTime,
  35. t.Person,
  36. t.Remark,u.F_Account,F_RealName
  37. ");
  38. strSql.Append(" FROM DutySchedule t left join adms7ultimate2.dbo.LR_Base_User u on t.Person=u.F_UserId ");
  39. strSql.Append(" WHERE 1=1 ");
  40. var queryParam = queryJson.ToJObject();
  41. // 虚拟参数
  42. var dp = new DynamicParameters(new { });
  43. return this.BaseRepository("CollegeMIS").FindList<DutyScheduleEntity>(strSql.ToString(),dp, pagination);
  44. }
  45. catch (Exception ex)
  46. {
  47. if (ex is ExceptionEx)
  48. {
  49. throw;
  50. }
  51. else
  52. {
  53. throw ExceptionEx.ThrowServiceException(ex);
  54. }
  55. }
  56. }
  57. /// <summary>
  58. /// 获取DutySchedule表实体数据
  59. /// <param name="keyValue">主键</param>
  60. /// <summary>
  61. /// <returns></returns>
  62. public DutyScheduleEntity GetDutyScheduleEntity(string keyValue)
  63. {
  64. try
  65. {
  66. return this.BaseRepository("CollegeMIS").FindEntity<DutyScheduleEntity>(keyValue);
  67. }
  68. catch (Exception ex)
  69. {
  70. if (ex is ExceptionEx)
  71. {
  72. throw;
  73. }
  74. else
  75. {
  76. throw ExceptionEx.ThrowServiceException(ex);
  77. }
  78. }
  79. }
  80. #endregion
  81. #region 提交数据
  82. /// <summary>
  83. /// 删除实体数据
  84. /// <param name="keyValue">主键</param>
  85. /// <summary>
  86. /// <returns></returns>
  87. public void DeleteEntity(string keyValue)
  88. {
  89. try
  90. {
  91. this.BaseRepository("CollegeMIS").Delete<DutyScheduleEntity>(t=>t.ID == keyValue);
  92. }
  93. catch (Exception ex)
  94. {
  95. if (ex is ExceptionEx)
  96. {
  97. throw;
  98. }
  99. else
  100. {
  101. throw ExceptionEx.ThrowServiceException(ex);
  102. }
  103. }
  104. }
  105. /// <summary>
  106. /// 保存实体数据(新增、修改)
  107. /// <param name="keyValue">主键</param>
  108. /// <summary>
  109. /// <returns></returns>
  110. public void SaveEntity(string keyValue, DutyScheduleEntity entity)
  111. {
  112. try
  113. {
  114. if (!string.IsNullOrEmpty(keyValue))
  115. {
  116. entity.Modify(keyValue);
  117. this.BaseRepository("CollegeMIS").Update(entity);
  118. }
  119. else
  120. {
  121. entity.Create();
  122. this.BaseRepository("CollegeMIS").Insert(entity);
  123. }
  124. }
  125. catch (Exception ex)
  126. {
  127. if (ex is ExceptionEx)
  128. {
  129. throw;
  130. }
  131. else
  132. {
  133. throw ExceptionEx.ThrowServiceException(ex);
  134. }
  135. }
  136. }
  137. #endregion
  138. }
  139. }