fix 逻辑恢复
This commit is contained in:
@@ -8,7 +8,6 @@ using Dlhis.Entity.Device.Entities;
|
|||||||
using Dlhis.Entity.Device.Enums;
|
using Dlhis.Entity.Device.Enums;
|
||||||
using Dlhis.Entity.Sys.Enums;
|
using Dlhis.Entity.Sys.Enums;
|
||||||
using Kurisu.AspNetCore.DataAccess.Dto;
|
using Kurisu.AspNetCore.DataAccess.Dto;
|
||||||
using Kurisu.AspNetCore.DataAccess.Extensions;
|
|
||||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Extensions;
|
||||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
||||||
using Kurisu.AspNetCore.Utils.Extensions;
|
using Kurisu.AspNetCore.Utils.Extensions;
|
||||||
@@ -53,12 +52,13 @@ public class GainfoPermissionService : IGainfoPermissionService
|
|||||||
|
|
||||||
var codes = permissions.SelectMany(x => x.AssignTypes.SelectMany(p => p.Codes)).Distinct().ToList();
|
var codes = permissions.SelectMany(x => x.AssignTypes.SelectMany(p => p.Codes)).Distinct().ToList();
|
||||||
|
|
||||||
var list = await _dbContext.Queryable<DeviceEntity>()
|
var page = await _dbContext.Queryable<DeviceEntity>()
|
||||||
.LeftJoin<DeviceRegistryEntity>((d, dr) => d.UniqueNo == dr.DeviceUniqueNo)
|
.LeftJoin<DeviceRegistryEntity>((d, dr) => d.UniqueNo == dr.DeviceUniqueNo)
|
||||||
|
.WhereIF(request.DeviceType.HasValue, d => d.Type == request.DeviceType)
|
||||||
.WhereIF(request.Search.IsPresent(), d => d.UniqueNo == request.Search)
|
.WhereIF(request.Search.IsPresent(), d => d.UniqueNo == request.Search)
|
||||||
.Where(d => codes.Contains(d.Code))
|
.Where(d => codes.Contains(d.Code))
|
||||||
.Select((d, dr) => new GainfoDevicePermissionResponse { Factory = d.TenantId }, true)
|
.Select((d, dr) => new GainfoDevicePermissionResponse { Factory = d.TenantId }, true)
|
||||||
.ToListAsync();
|
.ToPageListAsync(request);
|
||||||
|
|
||||||
var deviceGroups = await _dbContext.Queryable<DeviceGroupEntity>().Select(x => new { x.Code, x.Name }).ToListAsync();
|
var deviceGroups = await _dbContext.Queryable<DeviceGroupEntity>().Select(x => new { x.Code, x.Name }).ToListAsync();
|
||||||
var departments = permissions.Any(x => x.AssignTypes.Any(p => p.AssignType == AssignTypeEnumType.Department))
|
var departments = permissions.Any(x => x.AssignTypes.Any(p => p.AssignType == AssignTypeEnumType.Department))
|
||||||
@@ -69,7 +69,7 @@ public class GainfoPermissionService : IGainfoPermissionService
|
|||||||
? await _dbContext.Queryable<GainfoGroupEntity>().Select(x => new { x.Code, x.Name }).ToListAsync()
|
? await _dbContext.Queryable<GainfoGroupEntity>().Select(x => new { x.Code, x.Name }).ToListAsync()
|
||||||
: new[] { new { Code = Guid.Empty, Name = string.Empty } }.ToList();
|
: new[] { new { Code = Guid.Empty, Name = string.Empty } }.ToList();
|
||||||
|
|
||||||
list.Where(x => x.Type == request.DeviceType).ToList().ForEach(item =>
|
page.Data.ForEach(item =>
|
||||||
{
|
{
|
||||||
var permission = permissions.FirstOrDefault(x => x.Tenant == item.Factory);
|
var permission = permissions.FirstOrDefault(x => x.Tenant == item.Factory);
|
||||||
if (permission != null)
|
if (permission != null)
|
||||||
@@ -110,7 +110,7 @@ public class GainfoPermissionService : IGainfoPermissionService
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return list.ToPage(request);
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user