123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package com.ysnows.sultra.model;
- import android.text.TextUtils;
- import com.github.promeg.pinyinhelper.Pinyin;
- import com.litesuits.orm.LiteOrm;
- import com.litesuits.orm.db.annotation.Table;
- import com.litesuits.orm.db.assit.QueryBuilder;
- import com.ysnows.sultra.App;
- import java.util.ArrayList;
- @Table("city")
- public class City {
- public String City_ID;
- public String City_EN;
- public String City_EN_SIMPLE;
- public String City_CN;
- public String Country_code;
- public String Country_EN;
- public String Country_EN_SIMPLE;
- public String Country_CN;
- public String Province_EN;
- public String Province_EN_SIMPLE;
- public String Province_CN;
- public String Latitude;
- public String Longitude;
- public String AD_code;
- public static City findCityByName(String name) {
- if (TextUtils.isEmpty(name)) {
- return null;
- }
- LiteOrm liteOrm = App.getConfigOrm();
- ArrayList<City> res = null;
- if (Pinyin.isChinese(name.charAt(0))) {
- res = liteOrm.query(new QueryBuilder<>(City.class).where("City_CN = ?", name));
- } else {
- res = liteOrm.query(new QueryBuilder<>(City.class).where("City_EN = ?", name));
- }
- if (res != null && res.size() > 0) {
- return res.get(0);
- }
- return null;
- }
- }
|