using Infrastructure.Attribute;
using System.Collections.Generic;
using ARW.Model.System;
namespace ARW.Repository.System
{
///
/// 部门管理
///
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysDeptRepository : BaseRepository
{
///
///
///
///
///
public List SelectChildrenDeptById(long deptId)
{
string sql = "select * from sys_dept where find_in_set(@deptId, ancestors)";
return Context.SqlQueryable(sql).AddParameters(new { @deptId = deptId }).ToList();
}
public int UdateDeptChildren(List dept)
{
return Context.Updateable(dept).WhereColumns(f => new { f.DeptId })
.UpdateColumns(it => new { it.Ancestors }).ExecuteCommand();
}
}
///
/// 角色部门
///
[AppService(ServiceLifetime = LifeTime.Transient)]
public class SysRoleDeptRepository : BaseRepository
{
///
/// 根据角色获取菜单id
///
///
///
public List SelectRoleDeptByRoleId(long roleId)
{
return Context.Queryable().Where(it => it.RoleId == roleId).ToList();
}
}
}