Files
Yi.Admin/Yi.Framework.Net6/Yi.Framework.Service/DeptService.cs

31 lines
1009 B
C#
Raw Normal View History

2022-09-13 17:05:53 +08:00
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Yi.Framework.Common.Models;
using Yi.Framework.Interface;
using Yi.Framework.Model.Models;
using Yi.Framework.Repository;
namespace Yi.Framework.Service
{
public partial class DeptService
2022-09-13 17:05:53 +08:00
{
public async Task<List<DeptEntity>> SelctGetList(DeptEntity dept)
2022-09-13 17:05:53 +08:00
{
var data = await _repository._DbQueryable
.WhereIF(!string.IsNullOrEmpty(dept.DeptName), u => u.DeptName.Contains(dept.DeptName))
.WhereIF(dept.IsDeleted.IsNotNull(), u => u.IsDeleted == dept.IsDeleted)
.OrderBy(u => u.OrderNum, OrderByType.Desc)
.ToListAsync();
2022-09-13 17:05:53 +08:00
return data;
2022-09-13 17:05:53 +08:00
}
2022-09-15 19:45:51 +08:00
public async Task<List<DeptEntity>> GetListByRoleId(long roleId)
{
return (await _repository._Db.Queryable<RoleEntity>().Includes(r => r.Depts).SingleAsync(r => r.Id == roleId)).Depts;
}
2022-09-13 17:05:53 +08:00
}
}