package com.jiuqi.njt.register; import com.j256.ormlite.field.DatabaseField; /** * 客户端行政区划对象 * @author joe * */ public class KAdminAreaBean { @DatabaseField(generatedId = true) private int id; /** * "行政区划编号") */ @DatabaseField private long code; /** * "行政区划直属上级编号") */ @DatabaseField private long pCode; /** * 名称 */ @DatabaseField private String name; /** * comment = "省编号") */ @DatabaseField private int provinceCode; @DatabaseField private String provinceName; /** * "市编号") */ @DatabaseField private int cityCode; @DatabaseField private String cityName; /** * "县编号") */ @DatabaseField private int countryCode; @DatabaseField private String countryName; /** * "乡镇编号") */ @DatabaseField private int townCode; @DatabaseField private String townName; /** * "村编号") */ @DatabaseField private int villageCode; @DatabaseField private String villageName; /** * "经度", columnType=DBColumn.TypePoint) */ @DatabaseField private double longitude; /** * "纬度", columnType=DBColumn.TypePoint) */ @DatabaseField private double latitude; /** * 等级 */ @DatabaseField private int level; public long getCode() { return code; } public void setCode(long code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } public long getpCode() { return pCode; } public void setpCode(long pCode) { this.pCode = pCode; } public int getProvinceCode() { return provinceCode; } public void setProvinceCode(int provinceCode) { this.provinceCode = provinceCode; } public int getCityCode() { return cityCode; } public void setCityCode(int cityCode) { this.cityCode = cityCode; } public int getCountryCode() { return countryCode; } public void setCountryCode(int countryCode) { this.countryCode = countryCode; } public int getTownCode() { return townCode; } public void setTownCode(int townCode) { this.townCode = townCode; } public int getVillageCode() { return villageCode; } public void setVillageCode(int villageCode) { this.villageCode = villageCode; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } public String getProvinceName() { return provinceName; } public void setProvinceName(String provinceName) { this.provinceName = provinceName; } public String getCityName() { return cityName; } public void setCityName(String cityName) { this.cityName = cityName; } public String getCountryName() { return countryName; } public void setCountryName(String countryName) { this.countryName = countryName; } public String getTownName() { return townName; } public void setTownName(String townName) { this.townName = townName; } public String getVillageName() { return villageName; } public void setVillageName(String villageName) { this.villageName = villageName; } public String getFullName() { StringBuffer fullName = new StringBuffer(); if (getProvinceCode() != 0) { fullName.append(getProvinceName()); } if (getCityCode() != 0) { if (fullName.length() > 0) fullName.append(" "); fullName.append(getCityName()); } if (getCountryCode() != 0) { if (fullName.length() > 0) fullName.append(" "); fullName.append(getCountryName()); } if (getTownCode() != 0) { if (fullName.length() > 0) fullName.append(" "); fullName.append(getTownName()); } if (getVillageCode() != 0) { if (fullName.length() > 0) fullName.append(" "); fullName.append(getVillageName()); } return fullName.toString(); } public String getFullNameWithHref() { StringBuffer fullName = new StringBuffer(); if (getProvinceCode() != 0) { fullName.append("<span onclick='simpleFind(" + (getProvinceCode() > 9 ? getProvinceCode() : ("0" + getProvinceCode())) + "0000000000)'>" + getProvinceName() + "</span>"); } if (getCityCode() != 0) { if (fullName.length() > 0) fullName.append("->"); fullName.append("<span onclick='simpleFind(" + (getProvinceCode() > 9 ? getProvinceCode() : ("0" + getProvinceCode())) + (getCityCode() > 9 ? getCityCode() : ("0" + getCityCode())) + "00000000)'>" + getCityName() + "</span>"); } if (getCountryCode() != 0) { if (fullName.length() > 0) fullName.append("->"); fullName.append("<span onclick='simpleFind(" + (getProvinceCode() > 9 ? getProvinceCode() : ("0" + getProvinceCode())) + (getCityCode() > 9 ? getCityCode() : ("0" + getCityCode())) + (getCountryCode() > 9 ? getCountryCode() : ("0" + getCountryCode())) + "000000)'>" + getCountryName() + "</span>"); } // if (getTownCode() != 0) { // if (fullName.length() > 0) // fullName.append(" "); // fullName.append(getTownName()); // } // // if (getVillageCode() != 0) { // if (fullName.length() > 0) // fullName.append(" "); // fullName.append(getVillageName()); // } return fullName.toString(); } public String getFuName() { StringBuffer fullName = new StringBuffer(); if (getProvinceCode() != 0) { fullName.append(getProvinceName()); } if (getCityCode() != 0) { if (fullName.length() > 0) fullName.append(" "); fullName.append(getCityName()); } if (getCountryCode() != 0) { if (fullName.length() > 0) fullName.append(" "); fullName.append(getCountryName()); } return fullName.toString(); } /** * 行政区划级别<br/> * 0-全国、1-省、2-市、3-县、4-乡镇、5-村、 * * @return */ public int getLevel() { if (0 != villageCode) { this.level = 5; return 5; } else if (0 != townCode) { this.level = 4; return 4; } else if (0 != countryCode) { this.level = 3; return 3; } else if (0 != cityCode) { this.level = 2; return 2; } else if (0 != provinceCode) { this.level = 1; return 1; } else { this.level = 0; return 0; } } @Override public String toString() { return "AdminAreaBean[" + name + "," + code + "," + pCode + "," + provinceName + "," + cityName + "," + countryName + "," + townName + "," + villageName + "]"; } }