|
- using Models;
- using SqlSugar;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace Service
- {
- public class RoleService : Repository<Models.Role>
- {
- public List<Role> GetListNav()
- {
- return base.AsSugarClient().Queryable<Role>()
- .Includes(m => m.RightList)
- .Where(m=>m.Code!="admin")
- .ToList();
- }
- public bool DelNav(Role model)
- {
- return base.AsSugarClient().DeleteNav<Role>(model)
- .Include(a => a.RightList)
- .ExecuteCommand();
- }
- public bool UpdateNav(Role model)
- {
- return base.AsSugarClient().UpdateNav(model)
- .Include(a => a.RightList)//.ThenInclude(z1 => z1.RoomList) //插入2层 Root->ShoolA->RoomList
- .ExecuteCommand();
- }
- //获取所有子
- public List<Right> GetRightItems()
- {
- var db = base.Change<Right>();//切换仓仓(新功能)
- var list = db.GetList();
- return list;
- }
- //public List<Right> GetRightItems1()
- //{
- // var db = base.Change<Right>();//切换仓仓(新功能)
- // base.AsSugarClient().ThenMapper(list, map =>
- // {
-
- // });
- //}
- //分页
- //public List<Models.Role> GetOrderPage(Expression<Func<Models.Role, bool>> where, int pagesize, int pageindex)
- //{
- // return base.GetPageList(where, new SqlSugar.PageModel() { PageIndex = pageindex, PageSize = pagesize }); //使用自已的仓储方法
- //}
-
- //调用仓储扩展方法
- public List<Models.Role> GetOrderByJson(string Json)
- {
- return base.CommQuery(Json);
- }
- }
- }
|