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

com.haoxuer.discover.area.rest.conver.AreaDataSimpleConver Maven / Gradle / Ivy

package com.haoxuer.discover.area.rest.conver;

import com.haoxuer.discover.area.data.entity.Area;
import com.haoxuer.discover.area.rest.domain.response.simple.AreaDataSimple;
import com.haoxuer.discover.data.rest.core.Conver;
import com.haoxuer.discover.user.utils.ConverResourceUtils;

import java.util.ArrayList;

public class AreaDataSimpleConver implements Conver {
  @Override
  public AreaDataSimple conver(Area source) {
    
    AreaDataSimple result = new AreaDataSimple();
    result.setId(source.getId());
    result.setPid(source.getParentId());
    result.setName(source.getName());
    result.setLat(source.getLat());
    result.setLng(source.getLng());
    if (source.getAreaType() != null) {
      result.setType(source.getAreaType().ordinal());
    }
    result.setCode(source.getCode());
    if (source.getChildrens() != null && source.getChildrens().size() > 0) {
      result.setChilds(ConverResourceUtils.coverCollect(source.getChildrens(), this));
    } else {
      result.setChilds(new ArrayList());
    }
    return result;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy