Beispiel #1
0
        public ApiReturns GetDirsAndFiles(int id)
        {
            List <FileDirectory>   dirs;
            List <ViewDepartFiles> files;

            if (id == 0)
            {
                // 顶级目录,所有人看到的都一样
                dirs  = _dirBll.QueryList(d => d.IsTopestDir && !d.IsDeleted).ToList();
                files = new List <ViewDepartFiles>();
            }
            else
            {
                var loginUser = LoginStatus.GetLoginUser();
                var departId  = loginUser.DepartmentId;

                // 子目录,各单位的只能看到自己单位的以及公共的目录
                dirs = _dirBll.QueryList(
                    d => !d.IsDeleted && d.ParentId == id && // 定位到当前目录
                    (d.DepartmentId == departId || d.IsCommon))    // 查询公共的及单位私有的文件夹
                       .ToList();

                // 子目录,各单位的只能看到自己单位的以及公共的目录
                files = _fileBll.QueryList(
                    f => !f.IsDeleted && f.FileDirectoryId == id &&
                    (f.IsCommon || f.DepartmentId == departId))
                        .ToList();
            }

            return(ApiReturns.Ok(new { dirs, files }));
        }
        public ApiReturns Get(int id)
        {
            var list = _dirBll.QueryList(d => d.ParentId == id && d.IsDeleted == false);

            return(ApiReturns.Ok(list));
        }