All checks were successful
continuous-integration/drone/push Build is passing
- Add marker pole CRUD functionality with database tables (odf_marker_poles, odf_marker_pole_images) - Implement marker pole API endpoints and service layer with data isolation by department - Add UniApp pages for marker pole list, detail, and creation workflows - Add Vue management backend pages for marker pole and audit log management - Implement audit logging system via ActionFilter to track all business entity modifications - Extend search API to include marker poles in results alongside cables and faults - Add OdfAuditLogsController and service for querying audit trail data - Update optical box detail page with left-right frame color scheme (green-orange) - Add cable type page as entry point for marker poles and fault lists - Create database migration scripts for v1.2.0 schema and permissions - Add DeptDataScopeHelper for department-based data access control - Update MCP settings to disable SQL Server connection and fix formatting - Add marker pole service integration in UniApp with COS image upload support
40 lines
1.3 KiB
C#
40 lines
1.3 KiB
C#
using SqlSugar;
|
||
using ZR.Model.System;
|
||
|
||
namespace ZR.Service.Business
|
||
{
|
||
/// <summary>
|
||
/// 部门数据隔离工具类
|
||
/// 根据 DeptId 递归查询本级及所有下级部门 ID 列表
|
||
/// </summary>
|
||
public static class DeptDataScopeHelper
|
||
{
|
||
/// <summary>
|
||
/// 获取当前用户可见的部门ID列表(本级 + 所有下级)
|
||
/// </summary>
|
||
/// <param name="db">SqlSugar 客户端实例</param>
|
||
/// <param name="deptId">当前用户所属部门ID</param>
|
||
/// <returns>可见部门ID列表</returns>
|
||
public static List<long> GetVisibleDeptIds(ISqlSugarClient db, long deptId)
|
||
{
|
||
var allDepts = db.Queryable<SysDept>().ToList();
|
||
var result = new List<long> { deptId };
|
||
CollectChildDeptIds(allDepts, deptId, result);
|
||
return result;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 递归收集所有下级部门ID
|
||
/// </summary>
|
||
private static void CollectChildDeptIds(List<SysDept> all, long parentId, List<long> result)
|
||
{
|
||
var children = all.Where(d => d.ParentId == parentId).ToList();
|
||
foreach (var child in children)
|
||
{
|
||
result.Add(child.DeptId);
|
||
CollectChildDeptIds(all, child.DeptId, result);
|
||
}
|
||
}
|
||
}
|
||
}
|