ZrAdminNetCore/ZR.Repository/System/SysDeptRepository.cs
不做码农 40026f596f 测试
2021-09-27 08:06:09 +08:00

31 lines
901 B
C#

using Infrastructure.Attribute;
using System.Collections.Generic;
using ZR.Model.System;
namespace ZR.Repository.System
{
/// <summary>
/// 部门管理
/// </summary>
[AppService(ServiceLifetime= LifeTime.Transient)]
public class SysDeptRepository : BaseRepository<SysDept>
{
/// <summary>
///
/// </summary>
/// <param name="deptId"></param>
/// <returns></returns>
public List<SysDept> SelectChildrenDeptById(long deptId)
{
string sql = "select * from sys_dept where find_in_set(@deptId, ancestors)";
return Context.SqlQueryable<SysDept>(sql).AddParameters(new { @deptId = deptId }).ToList();
}
public int UdateDeptChildren(SysDept dept)
{
return Context.Updateable(dept).UpdateColumns(it => new { it.Ancestors }).ExecuteCommand();
}
}
}