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.
 
 
 
 
 
 

122 lines
3.4 KiB

  1. using Learun.DataBase.Repository;
  2. using Learun.Util;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. namespace Learun.Application.Base.SystemModule
  7. {
  8. /// <summary>
  9. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  10. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  11. /// 创建人:陈彬彬
  12. /// 日 期:2017.04.01
  13. /// 描 述:接口管理
  14. /// </summary>
  15. public class InterfaceService : RepositoryFactory
  16. {
  17. #region 属性 构造函数
  18. private string fieldSql;
  19. public InterfaceService()
  20. {
  21. fieldSql = @"
  22. t.F_Id,
  23. t.F_Name,
  24. t.F_Address,
  25. t.F_FieldsJson,
  26. t.F_CreateDate,
  27. t.F_CreateUserId,
  28. t.F_CreateUserName,
  29. t.F_ModifyDate,
  30. t.F_ModifyUserId,
  31. t.F_ModifyUserName
  32. ";
  33. }
  34. #endregion
  35. #region 获取数据
  36. /// <summary>
  37. /// 获取列表数据
  38. /// </summary>
  39. /// <returns></returns>
  40. public IEnumerable<InterfaceEntity> GetList()
  41. {
  42. try
  43. {
  44. StringBuilder strSql = new StringBuilder();
  45. strSql.Append("SELECT " + fieldSql + " FROM LR_Base_Interface t ");
  46. return this.BaseRepository().FindList<InterfaceEntity>(strSql.ToString());
  47. }
  48. catch (Exception ex)
  49. {
  50. if (ex is ExceptionEx)
  51. {
  52. throw;
  53. }
  54. else
  55. {
  56. throw ExceptionEx.ThrowServiceException(ex);
  57. }
  58. }
  59. }
  60. #endregion
  61. #region 提交数据
  62. /// <summary>
  63. /// 虚拟删除分类数据
  64. /// </summary>
  65. /// <param name="keyValue">主键</param>
  66. public void DeleteEntity(string keyValue)
  67. {
  68. try
  69. {
  70. this.BaseRepository().Delete<InterfaceEntity>(t => t.F_Id == keyValue);
  71. }
  72. catch (Exception ex)
  73. {
  74. if (ex is ExceptionEx)
  75. {
  76. throw;
  77. }
  78. else
  79. {
  80. throw ExceptionEx.ThrowServiceException(ex);
  81. }
  82. }
  83. }
  84. /// <summary>
  85. /// 保存分类数据实体
  86. /// </summary>
  87. /// <param name="keyValue">主键</param>
  88. /// <param name="entity">实体</param>
  89. public void SaveEntity(string keyValue, InterfaceEntity entity)
  90. {
  91. try
  92. {
  93. if (string.IsNullOrEmpty(keyValue))
  94. {
  95. entity.Create();
  96. this.BaseRepository().Insert(entity);
  97. }
  98. else
  99. {
  100. entity.Modify(keyValue);
  101. this.BaseRepository().Update(entity);
  102. }
  103. }
  104. catch (Exception ex)
  105. {
  106. if (ex is ExceptionEx)
  107. {
  108. throw;
  109. }
  110. else
  111. {
  112. throw ExceptionEx.ThrowServiceException(ex);
  113. }
  114. }
  115. }
  116. #endregion
  117. }
  118. }