All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arextest.web.model.mapper.DiffAggMapper Maven / Gradle / Ivy

The newest version!
package com.arextest.web.model.mapper;

import com.arextest.web.model.dao.mongodb.ReportDiffAggStatisticCollection;
import com.arextest.web.model.dao.mongodb.entity.SceneDetail;
import com.arextest.web.model.dto.DiffAggDto;
import com.arextest.web.model.dto.SceneDetailDto;
import java.util.HashMap;
import java.util.Map;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

@Mapper
public interface DiffAggMapper {

  DiffAggMapper INSTANCE = Mappers.getMapper(DiffAggMapper.class);

  ReportDiffAggStatisticCollection daoFromDto(DiffAggDto dto);

  DiffAggDto dtoFromDao(ReportDiffAggStatisticCollection dao);

  default Map> map1(Map> dto) {
    if (dto == null) {
      return null;
    }
    Map> result = new HashMap<>();
    dto.forEach((key, value) -> {
      if (value != null) {
        Map s = new HashMap<>();
        value.forEach((k, v) -> {
          SceneDetail sd = SceneDetailMapper.INSTANCE.daoFromDto(v);
          s.put(k, sd);
        });
        result.put(key, s);
      }
    });
    return result;
  }

  default Map> map(Map> dao) {
    if (dao == null) {
      return null;
    }
    Map> result = new HashMap<>();
    dao.forEach((key, value) -> {
      if (value != null) {
        Map s = new HashMap<>();
        value.forEach((k, v) -> {
          SceneDetailDto sd = SceneDetailMapper.INSTANCE.dtoFromDao(v);
          s.put(k, sd);
        });
        result.put(key, s);
      }
    });
    return result;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy