版博士V2.0程序
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.
 
 
 
 

61 lines
1.9 KiB

  1. using Models;
  2. using SqlSugar;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Linq.Expressions;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace Service
  10. {
  11. public class RoleService : Repository<Models.Role>
  12. {
  13. public List<Role> GetListNav()
  14. {
  15. return base.AsSugarClient().Queryable<Role>()
  16. .Includes(m => m.RightList)
  17. .Where(m=>m.Code!="admin")
  18. .ToList();
  19. }
  20. public bool DelNav(Role model)
  21. {
  22. return base.AsSugarClient().DeleteNav<Role>(model)
  23. .Include(a => a.RightList)
  24. .ExecuteCommand();
  25. }
  26. public bool UpdateNav(Role model)
  27. {
  28. return base.AsSugarClient().UpdateNav(model)
  29. .Include(a => a.RightList)//.ThenInclude(z1 => z1.RoomList) //插入2层 Root->ShoolA->RoomList
  30. .ExecuteCommand();
  31. }
  32. //获取所有子
  33. public List<Right> GetRightItems()
  34. {
  35. var db = base.Change<Right>();//切换仓仓(新功能)
  36. var list = db.GetList();
  37. return list;
  38. }
  39. //public List<Right> GetRightItems1()
  40. //{
  41. // var db = base.Change<Right>();//切换仓仓(新功能)
  42. // base.AsSugarClient().ThenMapper(list, map =>
  43. // {
  44. // });
  45. //}
  46. //分页
  47. //public List<Models.Role> GetOrderPage(Expression<Func<Models.Role, bool>> where, int pagesize, int pageindex)
  48. //{
  49. // return base.GetPageList(where, new SqlSugar.PageModel() { PageIndex = pageindex, PageSize = pagesize }); //使用自已的仓储方法
  50. //}
  51. //调用仓储扩展方法
  52. public List<Models.Role> GetOrderByJson(string Json)
  53. {
  54. return base.CommQuery(Json);
  55. }
  56. }
  57. }