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

com.haoxuer.discover.area.data.entity.Area Maven / Gradle / Ivy

package com.haoxuer.discover.area.data.entity;

import com.haoxuer.discover.area.data.enums.AreaState;
import com.haoxuer.discover.area.data.enums.AreaType;
import com.haoxuer.discover.data.entity.CatalogEntity;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;


@Entity
@Table(name = "area")
public class Area extends CatalogEntity {
  /**
   * 下属地区
   */
  @OneToMany(mappedBy = "parent", fetch = FetchType.LAZY)
  private List childrens;
  /**
   * 父地区id
   */
  @JoinColumn(name = "pid")
  @ManyToOne(fetch = FetchType.LAZY)
  private Area parent;
  /**
   * 城市状态 1为开通,0为未开通
   */
  private AreaState state;
  
  /**
   * 地理经度。
   */
  private Float lng;
  
  
  /**
   * 地理纬度。
   */
  private Float lat;
  
  @Column(name = "area_type")
  private AreaType areaType;
  
  /**
   * 全程
   */
  @Column(length = 20)
  private String fullName;
  
  /**
   * 政府编码
   */
  @Column(length = 12)
  private String govCode;
  
  
  public List getChildrens() {
    if (childrens != null && childrens.size() > 0) {
      return childrens;
      
    } else {
      return null;
      
    }
  }
  
  public void setChildrens(List childrens) {
    this.childrens = childrens;
  }
  
  
  public Area getParent() {
    return parent;
  }
  
  public void setParent(Area parent) {
    this.parent = parent;
  }
  
  @Override
  public Integer getParentId() {
    Area parent = getParent();
    if (parent != null) {
      return parent.getId();
    } else {
      return null;
    }
  }
  
  public AreaState getState() {
    return state;
  }
  
  public void setState(AreaState state) {
    this.state = state;
  }
  
  
  public Float getLng() {
    return lng;
  }
  
  public void setLng(Float lng) {
    this.lng = lng;
  }
  
  public Float getLat() {
    return lat;
  }
  
  public void setLat(Float lat) {
    this.lat = lat;
  }
  
  public AreaType getAreaType() {
    return areaType;
  }
  
  public void setAreaType(AreaType areaType) {
    this.areaType = areaType;
  }
  
  @Override
  public String toString() {
    return "Area{" +
        "type=" + areaType +
        "name=" + getName() +
        "code=" + getCode() +
        '}';
  }
  
  public String getGovCode() {
    return govCode;
  }
  
  public void setGovCode(String govCode) {
    this.govCode = govCode;
  }
  
  public String getFullName() {
    return fullName;
  }
  
  public void setFullName(String fullName) {
    this.fullName = fullName;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy