package com.tzy.common.dto;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.tzy.common.constant.Constants;
import com.tzy.common.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonIgnoreProperties(ignoreUnknown = true)
public class IpAddrDTO implements Serializable {
	private String country;
	private String province;
	private String city;

	public String getAddr(){
		StringBuffer buf = new StringBuffer();
		if(StringUtils.isNotEmpty(this.country)){
			buf.append(country).append(Constants.sub);
		}
		if(StringUtils.isNotEmpty(this.province)){
			buf.append(province).append(Constants.sub);
		}
		if(StringUtils.isNotEmpty(this.city)){
			buf.append(city);
		}
		return buf.toString();
	}
}