fix 手动添加isDeleted
This commit is contained in:
@@ -24,58 +24,7 @@ public class GainfoPermissionService : IGainfoPermissionService
|
||||
_devicePermissionAnalyzeService = devicePermissionAnalyzeService;
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<GetDevicesUnderGroupByUserNoResponse>> GetDevicesUnderGroupByUserNoAsync(string userNo, Guid deviceGroupCode)
|
||||
{
|
||||
var deviceGroups = await _dbContext.Queryable<DeviceGroupEntity>().ToListAsync();
|
||||
var currentGroup = deviceGroups.FirstOrDefault(x => x.Code == deviceGroupCode);
|
||||
if (currentGroup == null)
|
||||
{
|
||||
return new List<GetDevicesUnderGroupByUserNoResponse>();
|
||||
}
|
||||
|
||||
var groups = RecursionHelper.HandlerDeviceGroupNextCodes(currentGroup.Code, deviceGroups);
|
||||
|
||||
return groups.Select(groupCode =>
|
||||
{
|
||||
var nos = _dbContext.Queryable<DeviceGroupRelationshipEntity>()
|
||||
.LeftJoin<DeviceEntity>((x, d) => x.DeviceCode == d.Code)
|
||||
.Where(x => groupCode == x.GroupCode)
|
||||
.Select((x, d) => d.UniqueNo)
|
||||
.ToList();
|
||||
|
||||
var page = _dbContext.Queryable<DeviceEntity>()
|
||||
.LeftJoin<DeviceTemplateEntity>((d, dt) => d.TemplateCode == dt.Code)
|
||||
.LeftJoin<DeviceRegistryEntity>((d, dt, dr) => d.UniqueNo == dr.DeviceUniqueNo)
|
||||
.LeftJoin<BusinessPlaceEntity>((d, dt, dr, bp) => dr.BusinessPlaceCode == bp.Code)
|
||||
.Where(d => nos.Contains(d.UniqueNo))
|
||||
.Select((d, dt, dr, bp) => new DevicePageResponse
|
||||
{
|
||||
FuncsStr = d.Funcs.ToString(),
|
||||
Brand = dt.Brand,
|
||||
Type = d.Type,
|
||||
BusinessPlaceCode = bp.Code,
|
||||
BusinessPlaceName = bp.Name,
|
||||
LastHeartbeatTime = dr.LastHeartbeatTime,
|
||||
UniqueNo = d.UniqueNo,
|
||||
Supplier = d.Supplier,
|
||||
DeployPlace = d.DeployPlace,
|
||||
DeployPosition = d.DeployPosition,
|
||||
DeployDirection = d.DeployDirection,
|
||||
TemplateCode = dt.Code,
|
||||
ConnectionInfo = d.ConnectionInfo,
|
||||
Enable = d.Enable,
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return new GetDevicesUnderGroupByUserNoResponse
|
||||
{
|
||||
GroupCode = groupCode,
|
||||
Devices = page
|
||||
};
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<Pagination<GainfoDevicePermissionResponse>> GetAssignDeviceCodesAsync(DeviceAssUserCodeRequest request)
|
||||
|
||||
Reference in New Issue
Block a user