feat(dal,api): добавлен индекс в таблицу UnitInValues. В api изменены респонсы Template и Unit.
This commit is contained in:
@@ -114,25 +114,41 @@ namespace PARR.API.MappingProfiles
|
||||
|
||||
CreateMap<Unit, UnitResponse>()
|
||||
.Include<Unit, UnitWithAttributesResponse>()
|
||||
.Include<Unit, UnitRelationshipsAndAttributesResponse>()
|
||||
.ForMember(d => d.Name, o => o.MapFrom(s => s.Name));
|
||||
|
||||
|
||||
CreateMap<Unit, UnitWithAttributesResponse>()
|
||||
.ForMember(d => d.Childrens, o => o.MapFrom(s => s.ChildUnits.Select(t => t.ChildUnit).OrderBy(t => t.Name)))
|
||||
.ForMember(d => d.Parents, o => o.MapFrom(s => s.ParentUnits.Select(t => t.ParentUnit).OrderBy(t => t.Name)))
|
||||
.Include<Unit, UnitRelationshipsAndAttributesResponse>()
|
||||
.ForMember(d => d.Attributes, o => o.MapFrom(s => s.UnitValues.GroupBy(g => g.Field)
|
||||
.Select(fieldGroup => new AttributeResponse
|
||||
.Select(fieldGroup => new AttributeResponse
|
||||
{
|
||||
Field = new FieldResponse
|
||||
{
|
||||
Field = new FieldResponse
|
||||
{
|
||||
Id = fieldGroup.Key!.Id,
|
||||
Name = string.IsNullOrEmpty(fieldGroup.Key.DisplayName) ? fieldGroup.Key.AihitName : fieldGroup.Key.DisplayName,
|
||||
IsMultipleValue = fieldGroup.Key.IsMultipleValue
|
||||
},
|
||||
Values = fieldGroup.Select(s => new UnitFieldValueResponse { Id = s.ValueId, Value = s.Value!.Value }).ToList()
|
||||
}
|
||||
Id = fieldGroup.Key!.Id,
|
||||
Name = string.IsNullOrEmpty(fieldGroup.Key.DisplayName) ? fieldGroup.Key.AihitName : fieldGroup.Key.DisplayName,
|
||||
IsMultipleValue = fieldGroup.Key.IsMultipleValue
|
||||
},
|
||||
Values = fieldGroup.Select(s => new UnitFieldValueResponse { Id = s.ValueId, Value = s.Value!.Value }).ToList()
|
||||
}
|
||||
).OrderBy(o => o.Field.Name)
|
||||
));
|
||||
|
||||
CreateMap<Unit, UnitRelationshipsAndAttributesResponse>()
|
||||
.ForMember(d => d.Childrens, o => o.MapFrom(s => s.ChildUnits.Select(t => t.ChildUnit).OrderBy(t => t.Name)))
|
||||
.ForMember(d => d.Parents, o => o.MapFrom(s => s.ParentUnits.Select(t => t.ParentUnit).OrderBy(t => t.Name)));
|
||||
//.ForMember(d => d.Attributes, o => o.MapFrom(s => s.UnitValues.GroupBy(g => g.Field)
|
||||
// .Select(fieldGroup => new AttributeResponse
|
||||
// {
|
||||
// Field = new FieldResponse
|
||||
// {
|
||||
// Id = fieldGroup.Key!.Id,
|
||||
// Name = string.IsNullOrEmpty(fieldGroup.Key.DisplayName) ? fieldGroup.Key.AihitName : fieldGroup.Key.DisplayName,
|
||||
// IsMultipleValue = fieldGroup.Key.IsMultipleValue
|
||||
// },
|
||||
// Values = fieldGroup.Select(s => new UnitFieldValueResponse { Id = s.ValueId, Value = s.Value!.Value }).ToList()
|
||||
// }
|
||||
// ).OrderBy(o => o.Field.Name)
|
||||
//));
|
||||
#endregion
|
||||
|
||||
#region WorkGroup
|
||||
|
||||
Reference in New Issue
Block a user