studentService.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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-03-01 09:20
  16. /// 描 述:学生表
  17. /// </summary>
  18. public class studentService : RepositoryFactory<studentEntity>, studentIService
  19. {
  20. #region 获取数据
  21. /// <summary>
  22. /// 获取列表
  23. /// </summary>
  24. /// <param name="pagination">分页</param>
  25. /// <param name="queryJson">查询参数</param>
  26. /// <returns>返回分页列表</returns>
  27. public IEnumerable<studentEntity> GetPageList(Pagination pagination, string queryJson)
  28. {
  29. return this.BaseRepository().FindList(pagination);
  30. }
  31. /// <summary>
  32. /// 获取列表
  33. /// </summary>
  34. /// <param name="queryJson">查询参数</param>
  35. /// <returns>返回列表</returns>
  36. public IEnumerable<studentEntity> GetList(string queryJson)
  37. {
  38. return this.BaseRepository().IQueryable().ToList();
  39. }
  40. /// <summary>
  41. /// 获取实体
  42. /// </summary>
  43. /// <param name="keyValue">主键值</param>
  44. /// <returns></returns>
  45. public studentEntity GetEntity(string keyValue)
  46. {
  47. return this.BaseRepository().FindEntity(keyValue);
  48. }
  49. #endregion
  50. #region 提交数据
  51. /// <summary>
  52. /// 删除数据
  53. /// </summary>
  54. /// <param name="keyValue">主键</param>
  55. public void RemoveForm(string keyValue)
  56. {
  57. this.BaseRepository().Delete(keyValue);
  58. }
  59. /// <summary>
  60. /// 保存表单(新增、修改)
  61. /// </summary>
  62. /// <param name="keyValue">主键值</param>
  63. /// <param name="entity">实体对象</param>
  64. /// <returns></returns>
  65. public void SaveForm(string keyValue, studentEntity entity)
  66. {
  67. if (!string.IsNullOrEmpty(keyValue))
  68. {
  69. entity.Modify(keyValue);
  70. this.BaseRepository().Update(entity);
  71. }
  72. else
  73. {
  74. entity.Create();
  75. this.BaseRepository().Insert(entity);
  76. }
  77. }
  78. #endregion
  79. }
  80. }