Base_ModuleService.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using LeaRun.Application.Entity.BaseManage;
  2. using LeaRun.Application.IService.BaseManage;
  3. using LeaRun.Data.Repository;
  4. using LeaRun.Util.WebControl;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using LeaRun.Util;
  8. using LeaRun.Util.Extension;
  9. namespace LeaRun.Application.Service.BaseManage
  10. {
  11. /// <summary>
  12. /// 版 本 6.1
  13. /// Copyright (c) 2013-2016 上海力软信息技术有限公司
  14. /// 创 建:超级管理员
  15. /// 日 期:2017-02-22 21:03
  16. /// 描 述:系统功能表
  17. /// </summary>
  18. public class Base_ModuleService : RepositoryFactory<Base_ModuleEntity>, Base_ModuleIService
  19. {
  20. #region 获取数据
  21. /// <summary>
  22. /// 获取列表
  23. /// </summary>
  24. /// <param name="queryJson">查询参数</param>
  25. /// <returns>返回列表</returns>
  26. public IEnumerable<Base_ModuleEntity> GetList(string queryJson)
  27. {
  28. return this.BaseRepository().IQueryable().ToList();
  29. }
  30. /// <summary>
  31. /// 获取实体
  32. /// </summary>
  33. /// <param name="keyValue">主键值</param>
  34. /// <returns></returns>
  35. public Base_ModuleEntity GetEntity(string keyValue)
  36. {
  37. return this.BaseRepository().FindEntity(keyValue);
  38. }
  39. #endregion
  40. #region 提交数据
  41. /// <summary>
  42. /// 删除数据
  43. /// </summary>
  44. /// <param name="keyValue">主键</param>
  45. public void RemoveForm(string keyValue)
  46. {
  47. this.BaseRepository().Delete(keyValue);
  48. }
  49. /// <summary>
  50. /// 保存表单(新增、修改)
  51. /// </summary>
  52. /// <param name="keyValue">主键值</param>
  53. /// <param name="entity">实体对象</param>
  54. /// <returns></returns>
  55. public void SaveForm(string keyValue, Base_ModuleEntity entity)
  56. {
  57. if (!string.IsNullOrEmpty(keyValue))
  58. {
  59. entity.Modify(keyValue);
  60. this.BaseRepository().Update(entity);
  61. }
  62. else
  63. {
  64. entity.Create();
  65. this.BaseRepository().Insert(entity);
  66. }
  67. }
  68. #endregion
  69. }
  70. }