namespace SafeCampus.Application.Services.Business.DormitoryService;

public class ReturnDormitoryList: DormitoryInfoList
{
    /// <summary>
    /// 归寝人员数量
    /// </summary>
    public int DormitoryCount { get; set; }
}
public class ReturnDormitoryListMapper : IRegister
{
    public void Register(TypeAdapterConfig config)
    {
        config.ForType<DormitoryInfo, ReturnDormitoryList>()
            .Map(x => x.DormitoryCount, x => x.PersonInfos.Sum(xx=>xx.Attendances.GroupBy(xxx=>xxx.PersonId).Count()))
            .Map(x => x.PersonCount, x => x.PersonInfos.Count);
    }
}