parent
18e5870e7d
commit
cc0e95c53f
@ -0,0 +1,249 @@ |
|||||||
|
package com.hfkj.channel.llg.service; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.hfkj.channel.llg.config.LLGConfig; |
||||||
|
import com.hfkj.channel.llg.util.AesUtil; |
||||||
|
import com.hfkj.channel.llg.util.HttpsUtils; |
||||||
|
import com.hfkj.common.exception.ErrorCode; |
||||||
|
import com.hfkj.common.exception.ErrorHelp; |
||||||
|
import com.hfkj.common.exception.SysCode; |
||||||
|
import com.hfkj.config.CommonSysConst; |
||||||
|
import com.hfkj.entity.BsLklMcc; |
||||||
|
import com.hfkj.entity.BsTradeOrder; |
||||||
|
import com.hfkj.entity.LlgRegion; |
||||||
|
import com.hfkj.model.MerBasisModel; |
||||||
|
import com.hfkj.service.BsLklMccService; |
||||||
|
import com.hfkj.service.BsMerService; |
||||||
|
import com.hfkj.service.LlgRegionService; |
||||||
|
import com.hfkj.sysenum.MerSettleType; |
||||||
|
import com.hfkj.sysenum.MerStatusEnum; |
||||||
|
import com.hfkj.sysenum.MerTypeEnum; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Component; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.io.File; |
||||||
|
import java.math.BigDecimal; |
||||||
|
import java.net.HttpURLConnection; |
||||||
|
import java.net.URL; |
||||||
|
import java.text.DecimalFormat; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 零零购分期 |
||||||
|
* 商户业务 |
||||||
|
* @className: LLGOrderService |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/1/2 |
||||||
|
**/ |
||||||
|
@Component |
||||||
|
public class LLGMerService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private BsMerService merService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private LlgRegionService llgRegionService; |
||||||
|
|
||||||
|
@Resource |
||||||
|
private BsLklMccService mccService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 零零购商户入网申请417 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public Map<String,Object> merApply(Long merId) throws Exception { |
||||||
|
// 商户详情
|
||||||
|
MerBasisModel merDetail = merService.getMerDetail(merId); |
||||||
|
if (merDetail == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户"); |
||||||
|
} |
||||||
|
if (!merDetail.getMerStatus().equals(MerStatusEnum.status1.getNumber())) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户状态未处于正常"); |
||||||
|
} |
||||||
|
if (!merDetail.getMerType().equals(MerTypeEnum.status1.getNumber()) |
||||||
|
&& !merDetail.getMerType().equals(MerTypeEnum.status2.getNumber())) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户无法申请"); |
||||||
|
} |
||||||
|
// 查询零零购地区
|
||||||
|
LlgRegion llgRegion = llgRegionService.getDataByAreaCode(merDetail.getMerRegion().getAreaCode()); |
||||||
|
if (llgRegion == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的地区"); |
||||||
|
} |
||||||
|
// 查询MCC编码
|
||||||
|
BsLklMcc mccData = mccService.getMccByCode(merDetail.getMerMccCode()); |
||||||
|
if (mccData == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的MCC编码"); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String,Object> map = new HashMap<>(); |
||||||
|
if (merDetail.getMerType().equals(MerTypeEnum.status1.getNumber())) { |
||||||
|
map.put("mer_type", "1"); |
||||||
|
} else if (merDetail.getMerType().equals(MerTypeEnum.status2.getNumber())) { |
||||||
|
map.put("mer_type", "0"); |
||||||
|
} |
||||||
|
map.put("access_mode", 3); |
||||||
|
map.put("company_name", merDetail.getCompanyName()); |
||||||
|
map.put("merchant_sub_name", merDetail.getMerAbbreviate()); |
||||||
|
map.put("manager_name", merDetail.getRegName()); |
||||||
|
map.put("manager_phone", merDetail.getRegPhone()); |
||||||
|
map.put("manager_email", merDetail.getRegEmail()); |
||||||
|
map.put("legal_rep_phone", merDetail.getRegPhone()); |
||||||
|
|
||||||
|
map.put("province_code", llgRegion.getProvinceCode().toString()); |
||||||
|
map.put("Province1", llgRegion.getProvinceName()); |
||||||
|
map.put("city_code", llgRegion.getCityCode().toString()); |
||||||
|
map.put("city", llgRegion.getCityName()); |
||||||
|
map.put("district_code", llgRegion.getAreaCode().toString()); |
||||||
|
map.put("district_name", llgRegion.getAreaName()); |
||||||
|
map.put("scope", merDetail.getMerIndustry().getChildName()); |
||||||
|
map.put("mcc", "1005"); |
||||||
|
|
||||||
|
// 查询经营地区
|
||||||
|
LlgRegion bizRegion = llgRegionService.getDataByAreaCode(merDetail.getMerRegion().getAreaCode()); |
||||||
|
if (bizRegion == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的地区"); |
||||||
|
} |
||||||
|
map.put("biz_province_code", bizRegion.getProvinceCode().toString()); |
||||||
|
map.put("biz_city_code", bizRegion.getCityCode().toString()); |
||||||
|
map.put("biz_district_code", bizRegion.getAreaCode().toString()); |
||||||
|
map.put("biz_address", merDetail.getStoreModel().getAddress()); |
||||||
|
map.put("service_phone", merDetail.getRegName()); |
||||||
|
map.put("salesman_name", merDetail.getRegPhone()); |
||||||
|
map.put("salesman_phone", merDetail.getRegEmail()); |
||||||
|
|
||||||
|
/***** 分期配置 ******/ |
||||||
|
map.put("open_union_pay", 1); // 开通银联分期 1.开通 2.不开通
|
||||||
|
map.put("union_pay_fee_paid","2"); // 银联贴息方式 1:商户贴息 2:用户贴息 3:商户用户各一半
|
||||||
|
|
||||||
|
JSONObject unionpayRate = new JSONObject(); |
||||||
|
unionpayRate.put("3", "0.12"); |
||||||
|
unionpayRate.put("6", "0.34"); |
||||||
|
unionpayRate.put("12", "0.46"); |
||||||
|
|
||||||
|
map.put("unionpay_rate", unionpayRate.toString()); // 银联分期费率(1类银行)
|
||||||
|
map.put("unionpay_rate_1", unionpayRate.toString()); // 银联分期费率(2类银行)
|
||||||
|
|
||||||
|
/* map.put("open_hua_bei", 2); // 开通花呗分期 1.开通 2.不开通
|
||||||
|
map.put("hua_bei_pay_fee_paid", 2); // 花呗贴息方式 1:商户贴息 2:用户贴息*/
|
||||||
|
/***** 分期配置 ******/ |
||||||
|
|
||||||
|
/***** 营业执照 ******/ |
||||||
|
map.put("address", merDetail.getBlisRegAddress()); |
||||||
|
map.put("bus_lic_no", merDetail.getBlisNo()); |
||||||
|
map.put("license_begin_date", merDetail.getBlisPeriodStart().replace("年", "-").replace("月", "-").replace("日", "")); |
||||||
|
if (merDetail.getBlisPeriodType().equals(2)) { |
||||||
|
map.put("cert_indate", "29991231"); |
||||||
|
} else { |
||||||
|
map.put("cert_indate", merDetail.getBlisPeriodStart().replace("年", "-").replace("月", "-").replace("日", "")); |
||||||
|
} |
||||||
|
/***** 营业执照 ******/ |
||||||
|
|
||||||
|
/***** 法人信息 ******/ |
||||||
|
map.put("legal_rep", merDetail.getLarName()); |
||||||
|
map.put("legal_rep_id_card", merDetail.getLarIdCard()); |
||||||
|
map.put("legal_cert_begin_date", merDetail.getLarIdCardPeriodEnd().replace(".", "")); |
||||||
|
if (merDetail.getLarIdCardPeriodType().equals(2)) { |
||||||
|
map.put("legal_cert_end_date", "29991231"); |
||||||
|
} else { |
||||||
|
map.put("legal_cert_end_date", merDetail.getLarIdCardPeriodEnd().replace(".", "")); |
||||||
|
} |
||||||
|
/***** 法人信息 ******/ |
||||||
|
|
||||||
|
/***** 结算信息 ******/ |
||||||
|
if (merDetail.getMerSettleAcct().getSettleType().equals(MerSettleType.status1.getNumber())) { |
||||||
|
map.put("payment_type", 1); |
||||||
|
} else { |
||||||
|
map.put("payment_type", 2); |
||||||
|
} |
||||||
|
map.put("settlement_name", merDetail.getMerSettleAcct().getBankCardHolder()); |
||||||
|
map.put("settlement_acc", merDetail.getMerSettleAcct().getBankCardNo()); |
||||||
|
map.put("settlement_bank", merDetail.getMerSettleAcct().getOpenningBankName()); |
||||||
|
map.put("bank_top_code", "303"); |
||||||
|
map.put("Bank_code", merDetail.getMerSettleAcct().getOpenningBankCode()); |
||||||
|
map.put("bank_province", merDetail.getMerSettleAcct().getOpenningBankProvinceName()); |
||||||
|
map.put("bank_city", merDetail.getMerSettleAcct().getOpenningBankCityName()); |
||||||
|
/***** 结算信息 ******/ |
||||||
|
|
||||||
|
/***** 图片资料上传 ******/ |
||||||
|
// 营业执照
|
||||||
|
map.put("bus_lic_pic", upload(new File(CommonSysConst.getSysConfig().getFile_url() + "/" + merDetail.getBlisUrl()))); |
||||||
|
// 法人身份证正面照片
|
||||||
|
map.put("legal_rep_id_card_pic", upload(new File(CommonSysConst.getSysConfig().getFile_url() + "/" + merDetail.getLarIdCardPortraitImg()))); |
||||||
|
// 法人身份证背面照片
|
||||||
|
map.put("legal_rep_id_card_pic_back", upload(new File(CommonSysConst.getSysConfig().getFile_url() + "/" + merDetail.getLarIdCardNationalEmblemImg()))); |
||||||
|
|
||||||
|
if (merDetail.getMerSettleAcct().equals(MerSettleType.status1.getNumber())) { |
||||||
|
// 开户许可证
|
||||||
|
map.put("open_lic_pic", upload(new File(CommonSysConst.getSysConfig().getFile_url() + "/" + merDetail.getMerSettleAcct().getOpenningBankLicenseUrl()))); |
||||||
|
// 结算帐户照片
|
||||||
|
map.put("settlement_acc_pic", upload(new File(CommonSysConst.getSysConfig().getFile_url() + "/" + merDetail.getMerSettleAcct().getOpenningBankLicenseUrl()))); |
||||||
|
} else { |
||||||
|
// 开户许可证
|
||||||
|
map.put("open_lic_pic", upload(new File(CommonSysConst.getSysConfig().getFile_url() + "/" + merDetail.getMerSettleAcct().getBankCardImg()))); |
||||||
|
// 结算帐户照片
|
||||||
|
map.put("settlement_acc_pic", upload(new File(CommonSysConst.getSysConfig().getFile_url() + "/" + merDetail.getMerSettleAcct().getBankCardImg()))); |
||||||
|
} |
||||||
|
|
||||||
|
// 经营场所照片
|
||||||
|
List<String> premisePicList = new ArrayList<>(); |
||||||
|
premisePicList.add(upload(new File(CommonSysConst.getSysConfig().getFile_url() + "/" + merDetail.getStoreModel().getCashRegisterImg()))); |
||||||
|
premisePicList.add(upload(new File(CommonSysConst.getSysConfig().getFile_url() + "/" + merDetail.getStoreModel().getInternalImg()))); |
||||||
|
map.put("premise_pic", premisePicList); |
||||||
|
|
||||||
|
// 协议照片
|
||||||
|
map.put("agreement_pics", premisePicList); |
||||||
|
/***** 图片资料上传 ******/ |
||||||
|
|
||||||
|
System.out.println("请求:" + JSONObject.toJSONString(map)); |
||||||
|
String responseData = HttpsUtils.doLLGPost(LLGConfig.requestUrl + "/v3/openapi/sign/apply", AesUtil.aesEncrypt(LLGConfig.key, JSONObject.toJSONString(map))); |
||||||
|
return JSONObject.parseObject(AesUtil.aesDecrypt(LLGConfig.key, responseData), Map.class); |
||||||
|
|
||||||
|
/** |
||||||
|
* { |
||||||
|
* "data": { |
||||||
|
* "id": 3876 |
||||||
|
* }, |
||||||
|
* "status": { |
||||||
|
* "msg": "成功", |
||||||
|
* "code": 2000 |
||||||
|
* } |
||||||
|
* } |
||||||
|
*/ |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 零零购商户详情 |
||||||
|
* @param merId |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public Map<String,Object> merDetail(Long merId) throws Exception { |
||||||
|
// 商户详情
|
||||||
|
MerBasisModel merDetail = merService.getMerDetail(merId); |
||||||
|
if (merDetail == null) { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的商户"); |
||||||
|
} |
||||||
|
String responseData = HttpsUtils.doLLGGet(LLGConfig.requestUrl + "/v3/openapi/sign/apply/" + "3876"); |
||||||
|
return JSONObject.parseObject(AesUtil.aesDecrypt(LLGConfig.key, responseData), Map.class); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 入网附近上传 |
||||||
|
* @param file |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static String upload(File file) { |
||||||
|
JSONObject data = HttpsUtils.doPostUpload(LLGConfig.requestUrl + "/zjdt/v1/upload", file, new HashMap<>()); |
||||||
|
if (data.getInteger("code") == 1) { |
||||||
|
return data.getString("data"); |
||||||
|
} else { |
||||||
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, data.getString("message")); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,838 @@ |
|||||||
|
package com.hfkj.channel.llg.util; |
||||||
|
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.hfkj.channel.llg.config.LLGConfig; |
||||||
|
import org.apache.commons.io.IOUtils; |
||||||
|
import org.apache.http.HttpEntity; |
||||||
|
import org.apache.http.HttpResponse; |
||||||
|
import org.apache.http.NameValuePair; |
||||||
|
import org.apache.http.client.HttpClient; |
||||||
|
import org.apache.http.client.config.RequestConfig; |
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity; |
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse; |
||||||
|
import org.apache.http.client.methods.HttpGet; |
||||||
|
import org.apache.http.client.methods.HttpPost; |
||||||
|
import org.apache.http.conn.ssl.SSLConnectionSocketFactory; |
||||||
|
import org.apache.http.conn.ssl.SSLContexts; |
||||||
|
import org.apache.http.conn.ssl.TrustStrategy; |
||||||
|
import org.apache.http.entity.StringEntity; |
||||||
|
import org.apache.http.entity.mime.MultipartEntity; |
||||||
|
import org.apache.http.entity.mime.content.FileBody; |
||||||
|
import org.apache.http.impl.client.CloseableHttpClient; |
||||||
|
import org.apache.http.impl.client.HttpClients; |
||||||
|
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; |
||||||
|
import org.apache.http.message.BasicNameValuePair; |
||||||
|
import org.apache.http.ssl.SSLContextBuilder; |
||||||
|
import org.apache.http.util.EntityUtils; |
||||||
|
import org.slf4j.Logger; |
||||||
|
import org.slf4j.LoggerFactory; |
||||||
|
|
||||||
|
import javax.net.ssl.HostnameVerifier; |
||||||
|
import javax.net.ssl.SSLContext; |
||||||
|
import javax.net.ssl.SSLSession; |
||||||
|
import java.io.*; |
||||||
|
import java.net.HttpURLConnection; |
||||||
|
import java.net.MalformedURLException; |
||||||
|
import java.net.URL; |
||||||
|
import java.nio.charset.Charset; |
||||||
|
import java.security.GeneralSecurityException; |
||||||
|
import java.security.KeyStore; |
||||||
|
import java.security.cert.CertificateException; |
||||||
|
import java.security.cert.X509Certificate; |
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
public class HttpsUtils { |
||||||
|
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(HttpsUtils.class); |
||||||
|
|
||||||
|
private static PoolingHttpClientConnectionManager connMgr; |
||||||
|
private static RequestConfig requestConfig; |
||||||
|
private static final int MAX_TIMEOUT = 25000; |
||||||
|
|
||||||
|
static { |
||||||
|
// 设置连接池
|
||||||
|
connMgr = new PoolingHttpClientConnectionManager(); |
||||||
|
// 设置连接池大小
|
||||||
|
connMgr.setMaxTotal(5000); |
||||||
|
connMgr.setDefaultMaxPerRoute(2000); |
||||||
|
// Validate connections after 1 sec of inactivity
|
||||||
|
connMgr.setValidateAfterInactivity(1000); |
||||||
|
RequestConfig.Builder configBuilder = RequestConfig.custom(); |
||||||
|
// 设置连接超时
|
||||||
|
configBuilder.setConnectTimeout(MAX_TIMEOUT); |
||||||
|
// 设置读取超时
|
||||||
|
configBuilder.setSocketTimeout(MAX_TIMEOUT); |
||||||
|
// 设置从连接池获取连接实例的超时
|
||||||
|
configBuilder.setConnectionRequestTimeout(MAX_TIMEOUT); |
||||||
|
|
||||||
|
requestConfig = configBuilder.build(); |
||||||
|
} |
||||||
|
|
||||||
|
public static Object getHttpStats() { |
||||||
|
Map<String,Object> param = new LinkedHashMap<>(); |
||||||
|
param.put("totalStats", connMgr.getTotalStats()); |
||||||
|
param.put("routes", connMgr.getRoutes()); |
||||||
|
return param; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送 GET 请求(HTTP),不带输入数据 |
||||||
|
* |
||||||
|
* @param url |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static JSONObject doGet(String url) { |
||||||
|
return doGet(url, new HashMap<String, Object>()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送 GET 请求(HTTP),K-V形式 |
||||||
|
* |
||||||
|
* @param url |
||||||
|
* @param params |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static JSONObject doGet(String url, Map<String, Object> params) { |
||||||
|
String apiUrl = url; |
||||||
|
StringBuffer param = new StringBuffer(); |
||||||
|
int i = 0; |
||||||
|
for (String key : params.keySet()) { |
||||||
|
if (i == 0) |
||||||
|
param.append("?"); |
||||||
|
else |
||||||
|
param.append("&"); |
||||||
|
param.append(key).append("=").append(params.get(key)); |
||||||
|
i++; |
||||||
|
} |
||||||
|
apiUrl += param; |
||||||
|
String result = null; |
||||||
|
HttpClient httpClient = null; |
||||||
|
try { |
||||||
|
|
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
|
||||||
|
HttpGet httpGet = new HttpGet(apiUrl); |
||||||
|
HttpResponse response = httpClient.execute(httpGet); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
if (entity != null) { |
||||||
|
InputStream instream = entity.getContent(); |
||||||
|
result = IOUtils.toString(instream, "UTF-8"); |
||||||
|
} |
||||||
|
System.out.println(result); |
||||||
|
return JSON.parseObject(result); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static JSONObject doGet(String url, Map<String, String> params , String o) { |
||||||
|
String apiUrl = url; |
||||||
|
StringBuffer param = new StringBuffer(); |
||||||
|
int i = 0; |
||||||
|
for (String key : params.keySet()) { |
||||||
|
if (i == 0) |
||||||
|
param.append("?"); |
||||||
|
else |
||||||
|
param.append("&"); |
||||||
|
param.append(key).append("=").append(params.get(key)); |
||||||
|
i++; |
||||||
|
} |
||||||
|
apiUrl += param; |
||||||
|
String result = null; |
||||||
|
HttpClient httpClient = null; |
||||||
|
try { |
||||||
|
|
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
|
||||||
|
HttpGet httpGet = new HttpGet(apiUrl); |
||||||
|
HttpResponse response = httpClient.execute(httpGet); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
if (entity != null) { |
||||||
|
InputStream instream = entity.getContent(); |
||||||
|
result = IOUtils.toString(instream, "UTF-8"); |
||||||
|
} |
||||||
|
return JSON.parseObject(result); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static JSONObject doGet(String url, Map<String, String> params , Map<String , String> headers) { |
||||||
|
String apiUrl = url; |
||||||
|
StringBuffer param = new StringBuffer(); |
||||||
|
int i = 0; |
||||||
|
for (String key : params.keySet()) { |
||||||
|
if (i == 0) |
||||||
|
param.append("?"); |
||||||
|
else |
||||||
|
param.append("&"); |
||||||
|
param.append(key).append("=").append(params.get(key)); |
||||||
|
i++; |
||||||
|
} |
||||||
|
apiUrl += param; |
||||||
|
String result = null; |
||||||
|
HttpClient httpClient = null; |
||||||
|
try { |
||||||
|
|
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
|
||||||
|
HttpGet httpGet = new HttpGet(apiUrl); |
||||||
|
for (Map.Entry<String, String> e : headers.entrySet()) { |
||||||
|
httpGet.addHeader(e.getKey(), e.getValue()); |
||||||
|
} |
||||||
|
HttpResponse response = httpClient.execute(httpGet); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
if (entity != null) { |
||||||
|
InputStream instream = entity.getContent(); |
||||||
|
result = IOUtils.toString(instream, "UTF-8"); |
||||||
|
} |
||||||
|
return JSON.parseObject(result); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 发送 POST 请求(HTTP),不带输入数据 |
||||||
|
* |
||||||
|
* @param apiUrl |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static JSONObject doPost(String apiUrl) { |
||||||
|
return doPost(apiUrl, new HashMap<String, Object>()); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送 POST 请求,K-V形式 |
||||||
|
* |
||||||
|
* @param apiUrl |
||||||
|
* API接口URL |
||||||
|
* @param params |
||||||
|
* 参数map |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static JSONObject doPost(String apiUrl, Map<String, Object> params) { |
||||||
|
CloseableHttpClient httpClient = null; |
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
String httpStr = null; |
||||||
|
CloseableHttpResponse response = null; |
||||||
|
try { |
||||||
|
HttpPost httpPost = new HttpPost(apiUrl); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
List<NameValuePair> pairList = new ArrayList<>(params.size()); |
||||||
|
for (Map.Entry<String, Object> entry : params.entrySet()) { |
||||||
|
NameValuePair pair = new BasicNameValuePair(entry.getKey(), entry.getValue().toString()); |
||||||
|
pairList.add(pair); |
||||||
|
} |
||||||
|
httpPost.setEntity(new UrlEncodedFormEntity(pairList, Charset.forName("UTF-8"))); |
||||||
|
response = httpClient.execute(httpPost); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
httpStr = EntityUtils.toString(entity, "UTF-8"); |
||||||
|
return JSON.parseObject(httpStr); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} finally { |
||||||
|
if (response != null) { |
||||||
|
try { |
||||||
|
EntityUtils.consume(response.getEntity()); |
||||||
|
} catch (IOException e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 发送 POST 请求,K-V形式 |
||||||
|
* |
||||||
|
* @param apiUrl |
||||||
|
* API接口URL |
||||||
|
* @param params |
||||||
|
* 参数map |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static JSONObject doPostSendSms(String apiUrl, Map<String, Object> params) { |
||||||
|
CloseableHttpClient httpClient = null; |
||||||
|
|
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
String httpStr = null; |
||||||
|
CloseableHttpResponse response = null; |
||||||
|
try { |
||||||
|
HttpPost httpPost = new HttpPost(apiUrl); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
List<NameValuePair> pairList = new ArrayList<>(params.size()); |
||||||
|
for (Map.Entry<String, Object> entry : params.entrySet()) { |
||||||
|
NameValuePair pair = new BasicNameValuePair(entry.getKey(), entry.getValue().toString()); |
||||||
|
pairList.add(pair); |
||||||
|
} |
||||||
|
httpPost.setEntity(new UrlEncodedFormEntity(pairList, Charset.forName("UTF-8"))); |
||||||
|
response = httpClient.execute(httpPost); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
httpStr = EntityUtils.toString(entity, "UTF-8"); |
||||||
|
return JSON.parseObject(httpStr); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} finally { |
||||||
|
if (response != null) { |
||||||
|
try { |
||||||
|
EntityUtils.consume(response.getEntity()); |
||||||
|
} catch (IOException e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送 POST 请求,JSON形式 |
||||||
|
* |
||||||
|
* @param apiUrl |
||||||
|
* @param json |
||||||
|
* json对象 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static JSONObject doPost(String apiUrl, JSONObject json) { |
||||||
|
CloseableHttpClient httpClient = null; |
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
String httpStr = null; |
||||||
|
CloseableHttpResponse response = null; |
||||||
|
|
||||||
|
try { |
||||||
|
HttpPost httpPost = new HttpPost(apiUrl); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
StringEntity stringEntity = new StringEntity(json.toString(), "UTF-8");// 解决中文乱码问题
|
||||||
|
stringEntity.setContentEncoding("UTF-8"); |
||||||
|
stringEntity.setContentType("application/json"); |
||||||
|
httpPost.setEntity(stringEntity); |
||||||
|
response = httpClient.execute(httpPost); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
httpStr = EntityUtils.toString(entity, "UTF-8"); |
||||||
|
return JSON.parseObject(httpStr); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} finally { |
||||||
|
if (response != null) { |
||||||
|
try { |
||||||
|
EntityUtils.consume(response.getEntity()); |
||||||
|
} catch (IOException e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static String doLLGPost(String url, String data) throws Exception { |
||||||
|
URL obj = new URL(url); |
||||||
|
HttpURLConnection con = (HttpURLConnection) obj.openConnection(); |
||||||
|
// 设置请求方法为POST
|
||||||
|
con.setRequestMethod("POST"); |
||||||
|
// 添加请求头信息
|
||||||
|
con.addRequestProperty("Content-Type", "text/plain; charset=UTF-8"); |
||||||
|
con.setDoOutput(true); |
||||||
|
con.setDoInput(true); |
||||||
|
// 开始写入数据到输出流
|
||||||
|
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream()); |
||||||
|
writer.write(data); // 这里可以根据需要修改要发送的内容
|
||||||
|
writer.flush(); |
||||||
|
writer.close(); |
||||||
|
|
||||||
|
int responseCode = con.getResponseCode(); |
||||||
|
System.out.println("\nSending 'POST' request to URL : " + url); |
||||||
|
System.out.println("Post parameters : " + data); |
||||||
|
System.out.println("Response Code : " + responseCode); |
||||||
|
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); |
||||||
|
String inputLine; |
||||||
|
StringBuilder content = new StringBuilder(); |
||||||
|
|
||||||
|
while ((inputLine = in.readLine()) != null) { |
||||||
|
content.append(inputLine); |
||||||
|
} |
||||||
|
in.close(); |
||||||
|
|
||||||
|
System.out.println("Response Content : \n" + content); |
||||||
|
return content.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public static String doLLGGet(String url) throws Exception { |
||||||
|
URL obj = new URL(url); |
||||||
|
HttpURLConnection con = (HttpURLConnection) obj.openConnection(); |
||||||
|
// 设置请求方法为POST
|
||||||
|
con.setRequestMethod("GET"); |
||||||
|
// 添加请求头信息
|
||||||
|
con.addRequestProperty("Content-Type", "text/plain; charset=UTF-8"); |
||||||
|
con.setDoOutput(true); |
||||||
|
con.setDoInput(true); |
||||||
|
|
||||||
|
int responseCode = con.getResponseCode(); |
||||||
|
System.out.println("\nSending 'POST' request to URL : " + url); |
||||||
|
System.out.println("Response Code : " + responseCode); |
||||||
|
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); |
||||||
|
String inputLine; |
||||||
|
StringBuilder content = new StringBuilder(); |
||||||
|
|
||||||
|
while ((inputLine = in.readLine()) != null) { |
||||||
|
content.append(inputLine); |
||||||
|
} |
||||||
|
in.close(); |
||||||
|
|
||||||
|
System.out.println("Response Content : \n" + content); |
||||||
|
return content.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public static JSONObject doPostUpload(String apiUrl, File file, Map<String,Object> params) { |
||||||
|
CloseableHttpClient httpClient = null; |
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
|
||||||
|
StringBuffer param = new StringBuffer(); |
||||||
|
int i = 0; |
||||||
|
for (String key : params.keySet()) { |
||||||
|
if (i == 0) |
||||||
|
param.append("?"); |
||||||
|
else |
||||||
|
param.append("&"); |
||||||
|
param.append(key).append("=").append(params.get(key)); |
||||||
|
i++; |
||||||
|
} |
||||||
|
|
||||||
|
String httpStr = null; |
||||||
|
CloseableHttpResponse response = null; |
||||||
|
|
||||||
|
try { |
||||||
|
apiUrl += param; |
||||||
|
HttpPost httpPost = new HttpPost(apiUrl); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
|
||||||
|
MultipartEntity entity = new MultipartEntity(); |
||||||
|
entity.addPart("file", new FileBody(file)); |
||||||
|
|
||||||
|
httpPost.setEntity(entity); |
||||||
|
response = httpClient.execute(httpPost); |
||||||
|
HttpEntity responseEntity = response.getEntity(); |
||||||
|
return JSONObject.parseObject(EntityUtils.toString(responseEntity, "UTF-8")); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} finally { |
||||||
|
if (response != null) { |
||||||
|
try { |
||||||
|
EntityUtils.consume(response.getEntity()); |
||||||
|
} catch (IOException e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static String doPostForm(String url, String data) throws Exception { |
||||||
|
URL obj = new URL(url); |
||||||
|
HttpURLConnection con = (HttpURLConnection) obj.openConnection(); |
||||||
|
// 设置请求方法为POST
|
||||||
|
con.setRequestMethod("POST"); |
||||||
|
// 添加请求头信息
|
||||||
|
con.addRequestProperty("Content-Type", "text/plain; charset=UTF-8"); |
||||||
|
con.setDoOutput(true); |
||||||
|
con.setDoInput(true); |
||||||
|
// 开始写入数据到输出流
|
||||||
|
OutputStreamWriter writer = new OutputStreamWriter(con.getOutputStream()); |
||||||
|
writer.write(data); // 这里可以根据需要修改要发送的内容
|
||||||
|
writer.flush(); |
||||||
|
writer.close(); |
||||||
|
|
||||||
|
int responseCode = con.getResponseCode(); |
||||||
|
System.out.println("\nSending 'POST' request to URL : " + url); |
||||||
|
System.out.println("Post parameters : " + data); |
||||||
|
System.out.println("Response Code : " + responseCode); |
||||||
|
|
||||||
|
BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); |
||||||
|
String inputLine; |
||||||
|
StringBuilder content = new StringBuilder(); |
||||||
|
|
||||||
|
while ((inputLine = in.readLine()) != null) { |
||||||
|
content.append(inputLine); |
||||||
|
} |
||||||
|
in.close(); |
||||||
|
|
||||||
|
System.out.println("Response Content : \n" + content); |
||||||
|
return content.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public static JSONObject doPost(String apiUrl, Map<String,Object> body, Map<String,Object> header) { |
||||||
|
CloseableHttpClient httpClient = null; |
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
String httpStr = null; |
||||||
|
CloseableHttpResponse response = null; |
||||||
|
|
||||||
|
try { |
||||||
|
HttpPost httpPost = new HttpPost(apiUrl); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
for (Map.Entry<String, Object> entry : header.entrySet()) { |
||||||
|
httpPost.setHeader(entry.getKey(), entry.getValue().toString()); |
||||||
|
} |
||||||
|
StringEntity stringEntity = new StringEntity(JSON.toJSONString(body), "UTF-8");// 解决中文乱码问题
|
||||||
|
stringEntity.setContentEncoding("UTF-8"); |
||||||
|
stringEntity.setContentType("application/json"); |
||||||
|
httpPost.setEntity(stringEntity); |
||||||
|
response = httpClient.execute(httpPost); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
httpStr = EntityUtils.toString(entity, "UTF-8"); |
||||||
|
return JSON.parseObject(httpStr); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} finally { |
||||||
|
if (response != null) { |
||||||
|
try { |
||||||
|
EntityUtils.consume(response.getEntity()); |
||||||
|
} catch (IOException e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送 POST 请求,JSON形式 |
||||||
|
* |
||||||
|
* @param apiUrl |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static JSONObject doPost(String apiUrl, String str) { |
||||||
|
CloseableHttpClient httpClient = null; |
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
String httpStr = null; |
||||||
|
CloseableHttpResponse response = null; |
||||||
|
|
||||||
|
try { |
||||||
|
HttpPost httpPost = new HttpPost(apiUrl); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
StringEntity stringEntity = new StringEntity(str, "UTF-8");// 解决中文乱码问题
|
||||||
|
stringEntity.setContentEncoding("UTF-8"); |
||||||
|
stringEntity.setContentType("application/json"); |
||||||
|
httpPost.setEntity(stringEntity); |
||||||
|
response = httpClient.execute(httpPost); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
httpStr = EntityUtils.toString(entity, "UTF-8"); |
||||||
|
return JSON.parseObject(httpStr); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} finally { |
||||||
|
if (response != null) { |
||||||
|
try { |
||||||
|
EntityUtils.consume(response.getEntity()); |
||||||
|
} catch (IOException e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public static JSONObject doPost(String apiUrl, String str, String token, String sign, Long ts) { |
||||||
|
CloseableHttpClient httpClient = null; |
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
String httpStr = null; |
||||||
|
CloseableHttpResponse response = null; |
||||||
|
|
||||||
|
try { |
||||||
|
HttpPost httpPost = new HttpPost(apiUrl); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
httpPost.setHeader("token", token); |
||||||
|
httpPost.setHeader("sign", sign); |
||||||
|
httpPost.setHeader("ts", ts.toString()); |
||||||
|
StringEntity stringEntity = new StringEntity(str, "UTF-8");// 解决中文乱码问题
|
||||||
|
stringEntity.setContentEncoding("UTF-8"); |
||||||
|
stringEntity.setContentType("application/json"); |
||||||
|
httpPost.setEntity(stringEntity); |
||||||
|
response = httpClient.execute(httpPost); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
httpStr = EntityUtils.toString(entity, "UTF-8"); |
||||||
|
return JSON.parseObject(httpStr); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} finally { |
||||||
|
if (response != null) { |
||||||
|
try { |
||||||
|
EntityUtils.consume(response.getEntity()); |
||||||
|
} catch (IOException e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static JSONObject doPostSaasUpload(String apiUrl, File file, Map<String,Object> params, Map<String,Object> header) { |
||||||
|
CloseableHttpClient httpClient = null; |
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
|
||||||
|
StringBuffer param = new StringBuffer(); |
||||||
|
int i = 0; |
||||||
|
for (String key : params.keySet()) { |
||||||
|
if (i == 0) |
||||||
|
param.append("?"); |
||||||
|
else |
||||||
|
param.append("&"); |
||||||
|
param.append(key).append("=").append(params.get(key)); |
||||||
|
i++; |
||||||
|
} |
||||||
|
|
||||||
|
String httpStr = null; |
||||||
|
CloseableHttpResponse response = null; |
||||||
|
|
||||||
|
try { |
||||||
|
apiUrl += param; |
||||||
|
HttpPost httpPost = new HttpPost(apiUrl); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
for (Map.Entry<String, Object> entry : header.entrySet()) { |
||||||
|
httpPost.setHeader(entry.getKey(), entry.getValue().toString()); |
||||||
|
} |
||||||
|
|
||||||
|
MultipartEntity entity = new MultipartEntity(); |
||||||
|
entity.addPart("file", new FileBody(file)); |
||||||
|
|
||||||
|
httpPost.setEntity(entity); |
||||||
|
response = httpClient.execute(httpPost); |
||||||
|
HttpEntity responseEntity = response.getEntity(); |
||||||
|
httpStr = EntityUtils.toString(responseEntity, "UTF-8"); |
||||||
|
return JSON.parseObject(httpStr); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} finally { |
||||||
|
if (response != null) { |
||||||
|
try { |
||||||
|
EntityUtils.consume(response.getEntity()); |
||||||
|
} catch (IOException e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Saas 请求 |
||||||
|
* @param url |
||||||
|
* @param params |
||||||
|
* @param headers |
||||||
|
* @param formType |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static String doSaasGet(String url, Map<String, Object> params , Map<String , Object> headers, Boolean formType) { |
||||||
|
String apiUrl = url; |
||||||
|
StringBuffer param = new StringBuffer(); |
||||||
|
|
||||||
|
if (formType == true) { |
||||||
|
int i = 0; |
||||||
|
for (String key : params.keySet()) { |
||||||
|
if (i == 0) |
||||||
|
param.append("?"); |
||||||
|
else |
||||||
|
param.append("&"); |
||||||
|
param.append(key).append("=").append(params.get(key)); |
||||||
|
i++; |
||||||
|
} |
||||||
|
} else { |
||||||
|
for (String key : params.keySet()) { |
||||||
|
param.append("/" + params.get(key)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
apiUrl += param; |
||||||
|
String result = null; |
||||||
|
HttpClient httpClient = null; |
||||||
|
try { |
||||||
|
|
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
|
||||||
|
HttpGet httpGet = new HttpGet(apiUrl); |
||||||
|
for (Map.Entry<String, Object> e : headers.entrySet()) { |
||||||
|
httpGet.addHeader(e.getKey(), e.getValue().toString()); |
||||||
|
} |
||||||
|
HttpResponse response = httpClient.execute(httpGet); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
if (entity != null) { |
||||||
|
InputStream instream = entity.getContent(); |
||||||
|
result = IOUtils.toString(instream, "UTF-8"); |
||||||
|
} |
||||||
|
return result; |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Saas 请求 |
||||||
|
* @param url |
||||||
|
* @param params |
||||||
|
* @param headers |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static String doLLGGet(String url, Map<String, Object> params , Map<String , Object> headers) { |
||||||
|
String apiUrl = url; |
||||||
|
StringBuffer param = new StringBuffer(); |
||||||
|
|
||||||
|
int i = 0; |
||||||
|
for (String key : params.keySet()) { |
||||||
|
if (i == 0) |
||||||
|
param.append("?"); |
||||||
|
else |
||||||
|
param.append("&"); |
||||||
|
param.append(key).append("=").append(params.get(key)); |
||||||
|
i++; |
||||||
|
} |
||||||
|
|
||||||
|
apiUrl += param; |
||||||
|
String result = null; |
||||||
|
HttpClient httpClient = null; |
||||||
|
try { |
||||||
|
|
||||||
|
if (apiUrl.startsWith("https")) { |
||||||
|
httpClient = HttpClients.custom().setSSLSocketFactory(createSSLConnSocketFactory()) |
||||||
|
.setConnectionManager(connMgr).setDefaultRequestConfig(requestConfig).build(); |
||||||
|
} else { |
||||||
|
httpClient = HttpClients.createDefault(); |
||||||
|
} |
||||||
|
|
||||||
|
HttpGet httpGet = new HttpGet(apiUrl); |
||||||
|
for (Map.Entry<String, Object> e : headers.entrySet()) { |
||||||
|
httpGet.addHeader(e.getKey(), e.getValue().toString()); |
||||||
|
} |
||||||
|
HttpResponse response = httpClient.execute(httpGet); |
||||||
|
String location = Arrays.toString(response.getHeaders("Location")); |
||||||
|
System.out.println("----------------url:" + location); |
||||||
|
HttpEntity entity = response.getEntity(); |
||||||
|
if (entity != null) { |
||||||
|
InputStream instream = entity.getContent(); |
||||||
|
result = IOUtils.toString(instream, "UTF-8"); |
||||||
|
} |
||||||
|
System.out.println(result); |
||||||
|
return result; |
||||||
|
} catch (Exception e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static SSLConnectionSocketFactory readCertificate(String mchId) { |
||||||
|
try { |
||||||
|
KeyStore keyStore = KeyStore.getInstance("PKCS12"); |
||||||
|
FileInputStream stream = new FileInputStream( "F:/mine/hai-server/hai-service/src/main/java/privatekey/apiclient_cert.p12"); |
||||||
|
keyStore.load(stream , mchId.toCharArray()); |
||||||
|
stream.close(); |
||||||
|
SSLContext sslcontext = SSLContexts.custom().loadKeyMaterial(keyStore, mchId.toCharArray()).build(); |
||||||
|
return new SSLConnectionSocketFactory( |
||||||
|
sslcontext, |
||||||
|
new String[]{"TLSv1"}, |
||||||
|
null, |
||||||
|
SSLConnectionSocketFactory.BROWSER_COMPATIBLE_HOSTNAME_VERIFIER); |
||||||
|
} catch (Exception e) { |
||||||
|
System.out.println("证书双向认证出现异常" + e); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建SSL安全连接 |
||||||
|
* |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
private static SSLConnectionSocketFactory createSSLConnSocketFactory() { |
||||||
|
SSLConnectionSocketFactory sslsf = null; |
||||||
|
try { |
||||||
|
SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() { |
||||||
|
|
||||||
|
public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { |
||||||
|
return true; |
||||||
|
} |
||||||
|
}).build(); |
||||||
|
sslsf = new SSLConnectionSocketFactory(sslContext, new HostnameVerifier() { |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean verify(String arg0, SSLSession arg1) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
}); |
||||||
|
} catch (GeneralSecurityException e) { |
||||||
|
log.error(e.getMessage(),e); |
||||||
|
} |
||||||
|
return sslsf; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,117 @@ |
|||||||
|
package com.hfkj.dao; |
||||||
|
|
||||||
|
import com.hfkj.entity.LlgRegion; |
||||||
|
import com.hfkj.entity.LlgRegionExample; |
||||||
|
import java.util.List; |
||||||
|
import org.apache.ibatis.annotations.Delete; |
||||||
|
import org.apache.ibatis.annotations.DeleteProvider; |
||||||
|
import org.apache.ibatis.annotations.Insert; |
||||||
|
import org.apache.ibatis.annotations.InsertProvider; |
||||||
|
import org.apache.ibatis.annotations.Options; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
import org.apache.ibatis.annotations.Result; |
||||||
|
import org.apache.ibatis.annotations.Results; |
||||||
|
import org.apache.ibatis.annotations.Select; |
||||||
|
import org.apache.ibatis.annotations.SelectProvider; |
||||||
|
import org.apache.ibatis.annotations.Update; |
||||||
|
import org.apache.ibatis.annotations.UpdateProvider; |
||||||
|
import org.apache.ibatis.type.JdbcType; |
||||||
|
import org.springframework.stereotype.Repository; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* 代码由工具生成,请勿修改!!! |
||||||
|
* 如果需要扩展请在其父类进行扩展 |
||||||
|
* |
||||||
|
**/ |
||||||
|
@Repository |
||||||
|
public interface LlgRegionMapper extends LlgRegionMapperExt { |
||||||
|
@SelectProvider(type=LlgRegionSqlProvider.class, method="countByExample") |
||||||
|
long countByExample(LlgRegionExample example); |
||||||
|
|
||||||
|
@DeleteProvider(type=LlgRegionSqlProvider.class, method="deleteByExample") |
||||||
|
int deleteByExample(LlgRegionExample example); |
||||||
|
|
||||||
|
@Delete({ |
||||||
|
"delete from llg_region", |
||||||
|
"where id = #{id,jdbcType=BIGINT}" |
||||||
|
}) |
||||||
|
int deleteByPrimaryKey(Long id); |
||||||
|
|
||||||
|
@Insert({ |
||||||
|
"insert into llg_region (province_code, province_name, ", |
||||||
|
"city_code, city_name, ", |
||||||
|
"area_code, area_name, ", |
||||||
|
"ext_1, ext_2, ext_3)", |
||||||
|
"values (#{provinceCode,jdbcType=BIGINT}, #{provinceName,jdbcType=VARCHAR}, ", |
||||||
|
"#{cityCode,jdbcType=BIGINT}, #{cityName,jdbcType=VARCHAR}, ", |
||||||
|
"#{areaCode,jdbcType=BIGINT}, #{areaName,jdbcType=VARCHAR}, ", |
||||||
|
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR})" |
||||||
|
}) |
||||||
|
@Options(useGeneratedKeys=true,keyProperty="id") |
||||||
|
int insert(LlgRegion record); |
||||||
|
|
||||||
|
@InsertProvider(type=LlgRegionSqlProvider.class, method="insertSelective") |
||||||
|
@Options(useGeneratedKeys=true,keyProperty="id") |
||||||
|
int insertSelective(LlgRegion record); |
||||||
|
|
||||||
|
@SelectProvider(type=LlgRegionSqlProvider.class, method="selectByExample") |
||||||
|
@Results({ |
||||||
|
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||||
|
@Result(column="province_code", property="provinceCode", jdbcType=JdbcType.BIGINT), |
||||||
|
@Result(column="province_name", property="provinceName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="city_code", property="cityCode", jdbcType=JdbcType.BIGINT), |
||||||
|
@Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="area_code", property="areaCode", jdbcType=JdbcType.BIGINT), |
||||||
|
@Result(column="area_name", property="areaName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||||
|
}) |
||||||
|
List<LlgRegion> selectByExample(LlgRegionExample example); |
||||||
|
|
||||||
|
@Select({ |
||||||
|
"select", |
||||||
|
"id, province_code, province_name, city_code, city_name, area_code, area_name, ", |
||||||
|
"ext_1, ext_2, ext_3", |
||||||
|
"from llg_region", |
||||||
|
"where id = #{id,jdbcType=BIGINT}" |
||||||
|
}) |
||||||
|
@Results({ |
||||||
|
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), |
||||||
|
@Result(column="province_code", property="provinceCode", jdbcType=JdbcType.BIGINT), |
||||||
|
@Result(column="province_name", property="provinceName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="city_code", property="cityCode", jdbcType=JdbcType.BIGINT), |
||||||
|
@Result(column="city_name", property="cityName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="area_code", property="areaCode", jdbcType=JdbcType.BIGINT), |
||||||
|
@Result(column="area_name", property="areaName", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), |
||||||
|
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR) |
||||||
|
}) |
||||||
|
LlgRegion selectByPrimaryKey(Long id); |
||||||
|
|
||||||
|
@UpdateProvider(type=LlgRegionSqlProvider.class, method="updateByExampleSelective") |
||||||
|
int updateByExampleSelective(@Param("record") LlgRegion record, @Param("example") LlgRegionExample example); |
||||||
|
|
||||||
|
@UpdateProvider(type=LlgRegionSqlProvider.class, method="updateByExample") |
||||||
|
int updateByExample(@Param("record") LlgRegion record, @Param("example") LlgRegionExample example); |
||||||
|
|
||||||
|
@UpdateProvider(type=LlgRegionSqlProvider.class, method="updateByPrimaryKeySelective") |
||||||
|
int updateByPrimaryKeySelective(LlgRegion record); |
||||||
|
|
||||||
|
@Update({ |
||||||
|
"update llg_region", |
||||||
|
"set province_code = #{provinceCode,jdbcType=BIGINT},", |
||||||
|
"province_name = #{provinceName,jdbcType=VARCHAR},", |
||||||
|
"city_code = #{cityCode,jdbcType=BIGINT},", |
||||||
|
"city_name = #{cityName,jdbcType=VARCHAR},", |
||||||
|
"area_code = #{areaCode,jdbcType=BIGINT},", |
||||||
|
"area_name = #{areaName,jdbcType=VARCHAR},", |
||||||
|
"ext_1 = #{ext1,jdbcType=VARCHAR},", |
||||||
|
"ext_2 = #{ext2,jdbcType=VARCHAR},", |
||||||
|
"ext_3 = #{ext3,jdbcType=VARCHAR}", |
||||||
|
"where id = #{id,jdbcType=BIGINT}" |
||||||
|
}) |
||||||
|
int updateByPrimaryKey(LlgRegion record); |
||||||
|
} |
@ -0,0 +1,7 @@ |
|||||||
|
package com.hfkj.dao; |
||||||
|
|
||||||
|
/** |
||||||
|
* mapper扩展类 |
||||||
|
*/ |
||||||
|
public interface LlgRegionMapperExt { |
||||||
|
} |
@ -0,0 +1,304 @@ |
|||||||
|
package com.hfkj.dao; |
||||||
|
|
||||||
|
import com.hfkj.entity.LlgRegion; |
||||||
|
import com.hfkj.entity.LlgRegionExample.Criteria; |
||||||
|
import com.hfkj.entity.LlgRegionExample.Criterion; |
||||||
|
import com.hfkj.entity.LlgRegionExample; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import org.apache.ibatis.jdbc.SQL; |
||||||
|
|
||||||
|
public class LlgRegionSqlProvider { |
||||||
|
|
||||||
|
public String countByExample(LlgRegionExample example) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.SELECT("count(*)").FROM("llg_region"); |
||||||
|
applyWhere(sql, example, false); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String deleteByExample(LlgRegionExample example) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.DELETE_FROM("llg_region"); |
||||||
|
applyWhere(sql, example, false); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String insertSelective(LlgRegion record) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.INSERT_INTO("llg_region"); |
||||||
|
|
||||||
|
if (record.getProvinceCode() != null) { |
||||||
|
sql.VALUES("province_code", "#{provinceCode,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getProvinceName() != null) { |
||||||
|
sql.VALUES("province_name", "#{provinceName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityCode() != null) { |
||||||
|
sql.VALUES("city_code", "#{cityCode,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityName() != null) { |
||||||
|
sql.VALUES("city_name", "#{cityName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getAreaCode() != null) { |
||||||
|
sql.VALUES("area_code", "#{areaCode,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getAreaName() != null) { |
||||||
|
sql.VALUES("area_name", "#{areaName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt1() != null) { |
||||||
|
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt2() != null) { |
||||||
|
sql.VALUES("ext_2", "#{ext2,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt3() != null) { |
||||||
|
sql.VALUES("ext_3", "#{ext3,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String selectByExample(LlgRegionExample example) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
if (example != null && example.isDistinct()) { |
||||||
|
sql.SELECT_DISTINCT("id"); |
||||||
|
} else { |
||||||
|
sql.SELECT("id"); |
||||||
|
} |
||||||
|
sql.SELECT("province_code"); |
||||||
|
sql.SELECT("province_name"); |
||||||
|
sql.SELECT("city_code"); |
||||||
|
sql.SELECT("city_name"); |
||||||
|
sql.SELECT("area_code"); |
||||||
|
sql.SELECT("area_name"); |
||||||
|
sql.SELECT("ext_1"); |
||||||
|
sql.SELECT("ext_2"); |
||||||
|
sql.SELECT("ext_3"); |
||||||
|
sql.FROM("llg_region"); |
||||||
|
applyWhere(sql, example, false); |
||||||
|
|
||||||
|
if (example != null && example.getOrderByClause() != null) { |
||||||
|
sql.ORDER_BY(example.getOrderByClause()); |
||||||
|
} |
||||||
|
|
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String updateByExampleSelective(Map<String, Object> parameter) { |
||||||
|
LlgRegion record = (LlgRegion) parameter.get("record"); |
||||||
|
LlgRegionExample example = (LlgRegionExample) parameter.get("example"); |
||||||
|
|
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.UPDATE("llg_region"); |
||||||
|
|
||||||
|
if (record.getId() != null) { |
||||||
|
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getProvinceCode() != null) { |
||||||
|
sql.SET("province_code = #{record.provinceCode,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getProvinceName() != null) { |
||||||
|
sql.SET("province_name = #{record.provinceName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityCode() != null) { |
||||||
|
sql.SET("city_code = #{record.cityCode,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityName() != null) { |
||||||
|
sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getAreaCode() != null) { |
||||||
|
sql.SET("area_code = #{record.areaCode,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getAreaName() != null) { |
||||||
|
sql.SET("area_name = #{record.areaName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt1() != null) { |
||||||
|
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt2() != null) { |
||||||
|
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt3() != null) { |
||||||
|
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
applyWhere(sql, example, true); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String updateByExample(Map<String, Object> parameter) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.UPDATE("llg_region"); |
||||||
|
|
||||||
|
sql.SET("id = #{record.id,jdbcType=BIGINT}"); |
||||||
|
sql.SET("province_code = #{record.provinceCode,jdbcType=BIGINT}"); |
||||||
|
sql.SET("province_name = #{record.provinceName,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("city_code = #{record.cityCode,jdbcType=BIGINT}"); |
||||||
|
sql.SET("city_name = #{record.cityName,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("area_code = #{record.areaCode,jdbcType=BIGINT}"); |
||||||
|
sql.SET("area_name = #{record.areaName,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); |
||||||
|
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); |
||||||
|
|
||||||
|
LlgRegionExample example = (LlgRegionExample) parameter.get("example"); |
||||||
|
applyWhere(sql, example, true); |
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
public String updateByPrimaryKeySelective(LlgRegion record) { |
||||||
|
SQL sql = new SQL(); |
||||||
|
sql.UPDATE("llg_region"); |
||||||
|
|
||||||
|
if (record.getProvinceCode() != null) { |
||||||
|
sql.SET("province_code = #{provinceCode,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getProvinceName() != null) { |
||||||
|
sql.SET("province_name = #{provinceName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityCode() != null) { |
||||||
|
sql.SET("city_code = #{cityCode,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getCityName() != null) { |
||||||
|
sql.SET("city_name = #{cityName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getAreaCode() != null) { |
||||||
|
sql.SET("area_code = #{areaCode,jdbcType=BIGINT}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getAreaName() != null) { |
||||||
|
sql.SET("area_name = #{areaName,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt1() != null) { |
||||||
|
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt2() != null) { |
||||||
|
sql.SET("ext_2 = #{ext2,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
if (record.getExt3() != null) { |
||||||
|
sql.SET("ext_3 = #{ext3,jdbcType=VARCHAR}"); |
||||||
|
} |
||||||
|
|
||||||
|
sql.WHERE("id = #{id,jdbcType=BIGINT}"); |
||||||
|
|
||||||
|
return sql.toString(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void applyWhere(SQL sql, LlgRegionExample example, boolean includeExamplePhrase) { |
||||||
|
if (example == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
|
||||||
|
String parmPhrase1; |
||||||
|
String parmPhrase1_th; |
||||||
|
String parmPhrase2; |
||||||
|
String parmPhrase2_th; |
||||||
|
String parmPhrase3; |
||||||
|
String parmPhrase3_th; |
||||||
|
if (includeExamplePhrase) { |
||||||
|
parmPhrase1 = "%s #{example.oredCriteria[%d].allCriteria[%d].value}"; |
||||||
|
parmPhrase1_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||||
|
parmPhrase2 = "%s #{example.oredCriteria[%d].allCriteria[%d].value} and #{example.oredCriteria[%d].criteria[%d].secondValue}"; |
||||||
|
parmPhrase2_th = "%s #{example.oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{example.oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||||
|
parmPhrase3 = "#{example.oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||||
|
parmPhrase3_th = "#{example.oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||||
|
} else { |
||||||
|
parmPhrase1 = "%s #{oredCriteria[%d].allCriteria[%d].value}"; |
||||||
|
parmPhrase1_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s}"; |
||||||
|
parmPhrase2 = "%s #{oredCriteria[%d].allCriteria[%d].value} and #{oredCriteria[%d].criteria[%d].secondValue}"; |
||||||
|
parmPhrase2_th = "%s #{oredCriteria[%d].allCriteria[%d].value,typeHandler=%s} and #{oredCriteria[%d].criteria[%d].secondValue,typeHandler=%s}"; |
||||||
|
parmPhrase3 = "#{oredCriteria[%d].allCriteria[%d].value[%d]}"; |
||||||
|
parmPhrase3_th = "#{oredCriteria[%d].allCriteria[%d].value[%d],typeHandler=%s}"; |
||||||
|
} |
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder(); |
||||||
|
List<Criteria> oredCriteria = example.getOredCriteria(); |
||||||
|
boolean firstCriteria = true; |
||||||
|
for (int i = 0; i < oredCriteria.size(); i++) { |
||||||
|
Criteria criteria = oredCriteria.get(i); |
||||||
|
if (criteria.isValid()) { |
||||||
|
if (firstCriteria) { |
||||||
|
firstCriteria = false; |
||||||
|
} else { |
||||||
|
sb.append(" or "); |
||||||
|
} |
||||||
|
|
||||||
|
sb.append('('); |
||||||
|
List<Criterion> criterions = criteria.getAllCriteria(); |
||||||
|
boolean firstCriterion = true; |
||||||
|
for (int j = 0; j < criterions.size(); j++) { |
||||||
|
Criterion criterion = criterions.get(j); |
||||||
|
if (firstCriterion) { |
||||||
|
firstCriterion = false; |
||||||
|
} else { |
||||||
|
sb.append(" and "); |
||||||
|
} |
||||||
|
|
||||||
|
if (criterion.isNoValue()) { |
||||||
|
sb.append(criterion.getCondition()); |
||||||
|
} else if (criterion.isSingleValue()) { |
||||||
|
if (criterion.getTypeHandler() == null) { |
||||||
|
sb.append(String.format(parmPhrase1, criterion.getCondition(), i, j)); |
||||||
|
} else { |
||||||
|
sb.append(String.format(parmPhrase1_th, criterion.getCondition(), i, j,criterion.getTypeHandler())); |
||||||
|
} |
||||||
|
} else if (criterion.isBetweenValue()) { |
||||||
|
if (criterion.getTypeHandler() == null) { |
||||||
|
sb.append(String.format(parmPhrase2, criterion.getCondition(), i, j, i, j)); |
||||||
|
} else { |
||||||
|
sb.append(String.format(parmPhrase2_th, criterion.getCondition(), i, j, criterion.getTypeHandler(), i, j, criterion.getTypeHandler())); |
||||||
|
} |
||||||
|
} else if (criterion.isListValue()) { |
||||||
|
sb.append(criterion.getCondition()); |
||||||
|
sb.append(" ("); |
||||||
|
List<?> listItems = (List<?>) criterion.getValue(); |
||||||
|
boolean comma = false; |
||||||
|
for (int k = 0; k < listItems.size(); k++) { |
||||||
|
if (comma) { |
||||||
|
sb.append(", "); |
||||||
|
} else { |
||||||
|
comma = true; |
||||||
|
} |
||||||
|
if (criterion.getTypeHandler() == null) { |
||||||
|
sb.append(String.format(parmPhrase3, i, j, k)); |
||||||
|
} else { |
||||||
|
sb.append(String.format(parmPhrase3_th, i, j, k, criterion.getTypeHandler())); |
||||||
|
} |
||||||
|
} |
||||||
|
sb.append(')'); |
||||||
|
} |
||||||
|
} |
||||||
|
sb.append(')'); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
if (sb.length() > 0) { |
||||||
|
sql.WHERE(sb.toString()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,199 @@ |
|||||||
|
package com.hfkj.entity; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* llg_region |
||||||
|
* @author |
||||||
|
*/ |
||||||
|
/** |
||||||
|
* |
||||||
|
* 代码由工具生成 |
||||||
|
* |
||||||
|
**/ |
||||||
|
public class LlgRegion implements Serializable { |
||||||
|
/** |
||||||
|
* 主键 |
||||||
|
*/ |
||||||
|
private Long id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 省地区代码 |
||||||
|
*/ |
||||||
|
private Long provinceCode; |
||||||
|
|
||||||
|
/** |
||||||
|
* 省地区名称 |
||||||
|
*/ |
||||||
|
private String provinceName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 市地区代码 |
||||||
|
*/ |
||||||
|
private Long cityCode; |
||||||
|
|
||||||
|
/** |
||||||
|
* 市地区名称 |
||||||
|
*/ |
||||||
|
private String cityName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 区/县地区代码 |
||||||
|
*/ |
||||||
|
private Long areaCode; |
||||||
|
|
||||||
|
/** |
||||||
|
* 区/县地区名称 |
||||||
|
*/ |
||||||
|
private String areaName; |
||||||
|
|
||||||
|
private String ext1; |
||||||
|
|
||||||
|
private String ext2; |
||||||
|
|
||||||
|
private String ext3; |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
public Long getId() { |
||||||
|
return id; |
||||||
|
} |
||||||
|
|
||||||
|
public void setId(Long id) { |
||||||
|
this.id = id; |
||||||
|
} |
||||||
|
|
||||||
|
public Long getProvinceCode() { |
||||||
|
return provinceCode; |
||||||
|
} |
||||||
|
|
||||||
|
public void setProvinceCode(Long provinceCode) { |
||||||
|
this.provinceCode = provinceCode; |
||||||
|
} |
||||||
|
|
||||||
|
public String getProvinceName() { |
||||||
|
return provinceName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setProvinceName(String provinceName) { |
||||||
|
this.provinceName = provinceName; |
||||||
|
} |
||||||
|
|
||||||
|
public Long getCityCode() { |
||||||
|
return cityCode; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCityCode(Long cityCode) { |
||||||
|
this.cityCode = cityCode; |
||||||
|
} |
||||||
|
|
||||||
|
public String getCityName() { |
||||||
|
return cityName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCityName(String cityName) { |
||||||
|
this.cityName = cityName; |
||||||
|
} |
||||||
|
|
||||||
|
public Long getAreaCode() { |
||||||
|
return areaCode; |
||||||
|
} |
||||||
|
|
||||||
|
public void setAreaCode(Long areaCode) { |
||||||
|
this.areaCode = areaCode; |
||||||
|
} |
||||||
|
|
||||||
|
public String getAreaName() { |
||||||
|
return areaName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setAreaName(String areaName) { |
||||||
|
this.areaName = areaName; |
||||||
|
} |
||||||
|
|
||||||
|
public String getExt1() { |
||||||
|
return ext1; |
||||||
|
} |
||||||
|
|
||||||
|
public void setExt1(String ext1) { |
||||||
|
this.ext1 = ext1; |
||||||
|
} |
||||||
|
|
||||||
|
public String getExt2() { |
||||||
|
return ext2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setExt2(String ext2) { |
||||||
|
this.ext2 = ext2; |
||||||
|
} |
||||||
|
|
||||||
|
public String getExt3() { |
||||||
|
return ext3; |
||||||
|
} |
||||||
|
|
||||||
|
public void setExt3(String ext3) { |
||||||
|
this.ext3 = ext3; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean equals(Object that) { |
||||||
|
if (this == that) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
if (that == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
if (getClass() != that.getClass()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
LlgRegion other = (LlgRegion) that; |
||||||
|
return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId())) |
||||||
|
&& (this.getProvinceCode() == null ? other.getProvinceCode() == null : this.getProvinceCode().equals(other.getProvinceCode())) |
||||||
|
&& (this.getProvinceName() == null ? other.getProvinceName() == null : this.getProvinceName().equals(other.getProvinceName())) |
||||||
|
&& (this.getCityCode() == null ? other.getCityCode() == null : this.getCityCode().equals(other.getCityCode())) |
||||||
|
&& (this.getCityName() == null ? other.getCityName() == null : this.getCityName().equals(other.getCityName())) |
||||||
|
&& (this.getAreaCode() == null ? other.getAreaCode() == null : this.getAreaCode().equals(other.getAreaCode())) |
||||||
|
&& (this.getAreaName() == null ? other.getAreaName() == null : this.getAreaName().equals(other.getAreaName())) |
||||||
|
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) |
||||||
|
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) |
||||||
|
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public int hashCode() { |
||||||
|
final int prime = 31; |
||||||
|
int result = 1; |
||||||
|
result = prime * result + ((getId() == null) ? 0 : getId().hashCode()); |
||||||
|
result = prime * result + ((getProvinceCode() == null) ? 0 : getProvinceCode().hashCode()); |
||||||
|
result = prime * result + ((getProvinceName() == null) ? 0 : getProvinceName().hashCode()); |
||||||
|
result = prime * result + ((getCityCode() == null) ? 0 : getCityCode().hashCode()); |
||||||
|
result = prime * result + ((getCityName() == null) ? 0 : getCityName().hashCode()); |
||||||
|
result = prime * result + ((getAreaCode() == null) ? 0 : getAreaCode().hashCode()); |
||||||
|
result = prime * result + ((getAreaName() == null) ? 0 : getAreaName().hashCode()); |
||||||
|
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); |
||||||
|
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); |
||||||
|
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
StringBuilder sb = new StringBuilder(); |
||||||
|
sb.append(getClass().getSimpleName()); |
||||||
|
sb.append(" ["); |
||||||
|
sb.append("Hash = ").append(hashCode()); |
||||||
|
sb.append(", id=").append(id); |
||||||
|
sb.append(", provinceCode=").append(provinceCode); |
||||||
|
sb.append(", provinceName=").append(provinceName); |
||||||
|
sb.append(", cityCode=").append(cityCode); |
||||||
|
sb.append(", cityName=").append(cityName); |
||||||
|
sb.append(", areaCode=").append(areaCode); |
||||||
|
sb.append(", areaName=").append(areaName); |
||||||
|
sb.append(", ext1=").append(ext1); |
||||||
|
sb.append(", ext2=").append(ext2); |
||||||
|
sb.append(", ext3=").append(ext3); |
||||||
|
sb.append(", serialVersionUID=").append(serialVersionUID); |
||||||
|
sb.append("]"); |
||||||
|
return sb.toString(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,882 @@ |
|||||||
|
package com.hfkj.entity; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
public class LlgRegionExample { |
||||||
|
protected String orderByClause; |
||||||
|
|
||||||
|
protected boolean distinct; |
||||||
|
|
||||||
|
protected List<Criteria> oredCriteria; |
||||||
|
|
||||||
|
private Integer limit; |
||||||
|
|
||||||
|
private Long offset; |
||||||
|
|
||||||
|
public LlgRegionExample() { |
||||||
|
oredCriteria = new ArrayList<Criteria>(); |
||||||
|
} |
||||||
|
|
||||||
|
public void setOrderByClause(String orderByClause) { |
||||||
|
this.orderByClause = orderByClause; |
||||||
|
} |
||||||
|
|
||||||
|
public String getOrderByClause() { |
||||||
|
return orderByClause; |
||||||
|
} |
||||||
|
|
||||||
|
public void setDistinct(boolean distinct) { |
||||||
|
this.distinct = distinct; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isDistinct() { |
||||||
|
return distinct; |
||||||
|
} |
||||||
|
|
||||||
|
public List<Criteria> getOredCriteria() { |
||||||
|
return oredCriteria; |
||||||
|
} |
||||||
|
|
||||||
|
public void or(Criteria criteria) { |
||||||
|
oredCriteria.add(criteria); |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria or() { |
||||||
|
Criteria criteria = createCriteriaInternal(); |
||||||
|
oredCriteria.add(criteria); |
||||||
|
return criteria; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria createCriteria() { |
||||||
|
Criteria criteria = createCriteriaInternal(); |
||||||
|
if (oredCriteria.size() == 0) { |
||||||
|
oredCriteria.add(criteria); |
||||||
|
} |
||||||
|
return criteria; |
||||||
|
} |
||||||
|
|
||||||
|
protected Criteria createCriteriaInternal() { |
||||||
|
Criteria criteria = new Criteria(); |
||||||
|
return criteria; |
||||||
|
} |
||||||
|
|
||||||
|
public void clear() { |
||||||
|
oredCriteria.clear(); |
||||||
|
orderByClause = null; |
||||||
|
distinct = false; |
||||||
|
} |
||||||
|
|
||||||
|
public void setLimit(Integer limit) { |
||||||
|
this.limit = limit; |
||||||
|
} |
||||||
|
|
||||||
|
public Integer getLimit() { |
||||||
|
return limit; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOffset(Long offset) { |
||||||
|
this.offset = offset; |
||||||
|
} |
||||||
|
|
||||||
|
public Long getOffset() { |
||||||
|
return offset; |
||||||
|
} |
||||||
|
|
||||||
|
protected abstract static class GeneratedCriteria { |
||||||
|
protected List<Criterion> criteria; |
||||||
|
|
||||||
|
protected GeneratedCriteria() { |
||||||
|
super(); |
||||||
|
criteria = new ArrayList<Criterion>(); |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isValid() { |
||||||
|
return criteria.size() > 0; |
||||||
|
} |
||||||
|
|
||||||
|
public List<Criterion> getAllCriteria() { |
||||||
|
return criteria; |
||||||
|
} |
||||||
|
|
||||||
|
public List<Criterion> getCriteria() { |
||||||
|
return criteria; |
||||||
|
} |
||||||
|
|
||||||
|
protected void addCriterion(String condition) { |
||||||
|
if (condition == null) { |
||||||
|
throw new RuntimeException("Value for condition cannot be null"); |
||||||
|
} |
||||||
|
criteria.add(new Criterion(condition)); |
||||||
|
} |
||||||
|
|
||||||
|
protected void addCriterion(String condition, Object value, String property) { |
||||||
|
if (value == null) { |
||||||
|
throw new RuntimeException("Value for " + property + " cannot be null"); |
||||||
|
} |
||||||
|
criteria.add(new Criterion(condition, value)); |
||||||
|
} |
||||||
|
|
||||||
|
protected void addCriterion(String condition, Object value1, Object value2, String property) { |
||||||
|
if (value1 == null || value2 == null) { |
||||||
|
throw new RuntimeException("Between values for " + property + " cannot be null"); |
||||||
|
} |
||||||
|
criteria.add(new Criterion(condition, value1, value2)); |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdIsNull() { |
||||||
|
addCriterion("id is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdIsNotNull() { |
||||||
|
addCriterion("id is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdEqualTo(Long value) { |
||||||
|
addCriterion("id =", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdNotEqualTo(Long value) { |
||||||
|
addCriterion("id <>", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdGreaterThan(Long value) { |
||||||
|
addCriterion("id >", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdGreaterThanOrEqualTo(Long value) { |
||||||
|
addCriterion("id >=", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdLessThan(Long value) { |
||||||
|
addCriterion("id <", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdLessThanOrEqualTo(Long value) { |
||||||
|
addCriterion("id <=", value, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdIn(List<Long> values) { |
||||||
|
addCriterion("id in", values, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdNotIn(List<Long> values) { |
||||||
|
addCriterion("id not in", values, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdBetween(Long value1, Long value2) { |
||||||
|
addCriterion("id between", value1, value2, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andIdNotBetween(Long value1, Long value2) { |
||||||
|
addCriterion("id not between", value1, value2, "id"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeIsNull() { |
||||||
|
addCriterion("province_code is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeIsNotNull() { |
||||||
|
addCriterion("province_code is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeEqualTo(Long value) { |
||||||
|
addCriterion("province_code =", value, "provinceCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeNotEqualTo(Long value) { |
||||||
|
addCriterion("province_code <>", value, "provinceCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeGreaterThan(Long value) { |
||||||
|
addCriterion("province_code >", value, "provinceCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeGreaterThanOrEqualTo(Long value) { |
||||||
|
addCriterion("province_code >=", value, "provinceCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeLessThan(Long value) { |
||||||
|
addCriterion("province_code <", value, "provinceCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeLessThanOrEqualTo(Long value) { |
||||||
|
addCriterion("province_code <=", value, "provinceCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeIn(List<Long> values) { |
||||||
|
addCriterion("province_code in", values, "provinceCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeNotIn(List<Long> values) { |
||||||
|
addCriterion("province_code not in", values, "provinceCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeBetween(Long value1, Long value2) { |
||||||
|
addCriterion("province_code between", value1, value2, "provinceCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceCodeNotBetween(Long value1, Long value2) { |
||||||
|
addCriterion("province_code not between", value1, value2, "provinceCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameIsNull() { |
||||||
|
addCriterion("province_name is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameIsNotNull() { |
||||||
|
addCriterion("province_name is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameEqualTo(String value) { |
||||||
|
addCriterion("province_name =", value, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameNotEqualTo(String value) { |
||||||
|
addCriterion("province_name <>", value, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameGreaterThan(String value) { |
||||||
|
addCriterion("province_name >", value, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameGreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("province_name >=", value, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameLessThan(String value) { |
||||||
|
addCriterion("province_name <", value, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameLessThanOrEqualTo(String value) { |
||||||
|
addCriterion("province_name <=", value, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameLike(String value) { |
||||||
|
addCriterion("province_name like", value, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameNotLike(String value) { |
||||||
|
addCriterion("province_name not like", value, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameIn(List<String> values) { |
||||||
|
addCriterion("province_name in", values, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameNotIn(List<String> values) { |
||||||
|
addCriterion("province_name not in", values, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameBetween(String value1, String value2) { |
||||||
|
addCriterion("province_name between", value1, value2, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andProvinceNameNotBetween(String value1, String value2) { |
||||||
|
addCriterion("province_name not between", value1, value2, "provinceName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeIsNull() { |
||||||
|
addCriterion("city_code is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeIsNotNull() { |
||||||
|
addCriterion("city_code is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeEqualTo(Long value) { |
||||||
|
addCriterion("city_code =", value, "cityCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeNotEqualTo(Long value) { |
||||||
|
addCriterion("city_code <>", value, "cityCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeGreaterThan(Long value) { |
||||||
|
addCriterion("city_code >", value, "cityCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeGreaterThanOrEqualTo(Long value) { |
||||||
|
addCriterion("city_code >=", value, "cityCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeLessThan(Long value) { |
||||||
|
addCriterion("city_code <", value, "cityCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeLessThanOrEqualTo(Long value) { |
||||||
|
addCriterion("city_code <=", value, "cityCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeIn(List<Long> values) { |
||||||
|
addCriterion("city_code in", values, "cityCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeNotIn(List<Long> values) { |
||||||
|
addCriterion("city_code not in", values, "cityCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeBetween(Long value1, Long value2) { |
||||||
|
addCriterion("city_code between", value1, value2, "cityCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityCodeNotBetween(Long value1, Long value2) { |
||||||
|
addCriterion("city_code not between", value1, value2, "cityCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameIsNull() { |
||||||
|
addCriterion("city_name is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameIsNotNull() { |
||||||
|
addCriterion("city_name is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameEqualTo(String value) { |
||||||
|
addCriterion("city_name =", value, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameNotEqualTo(String value) { |
||||||
|
addCriterion("city_name <>", value, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameGreaterThan(String value) { |
||||||
|
addCriterion("city_name >", value, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameGreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("city_name >=", value, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameLessThan(String value) { |
||||||
|
addCriterion("city_name <", value, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameLessThanOrEqualTo(String value) { |
||||||
|
addCriterion("city_name <=", value, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameLike(String value) { |
||||||
|
addCriterion("city_name like", value, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameNotLike(String value) { |
||||||
|
addCriterion("city_name not like", value, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameIn(List<String> values) { |
||||||
|
addCriterion("city_name in", values, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameNotIn(List<String> values) { |
||||||
|
addCriterion("city_name not in", values, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameBetween(String value1, String value2) { |
||||||
|
addCriterion("city_name between", value1, value2, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andCityNameNotBetween(String value1, String value2) { |
||||||
|
addCriterion("city_name not between", value1, value2, "cityName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeIsNull() { |
||||||
|
addCriterion("area_code is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeIsNotNull() { |
||||||
|
addCriterion("area_code is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeEqualTo(Long value) { |
||||||
|
addCriterion("area_code =", value, "areaCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeNotEqualTo(Long value) { |
||||||
|
addCriterion("area_code <>", value, "areaCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeGreaterThan(Long value) { |
||||||
|
addCriterion("area_code >", value, "areaCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeGreaterThanOrEqualTo(Long value) { |
||||||
|
addCriterion("area_code >=", value, "areaCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeLessThan(Long value) { |
||||||
|
addCriterion("area_code <", value, "areaCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeLessThanOrEqualTo(Long value) { |
||||||
|
addCriterion("area_code <=", value, "areaCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeIn(List<Long> values) { |
||||||
|
addCriterion("area_code in", values, "areaCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeNotIn(List<Long> values) { |
||||||
|
addCriterion("area_code not in", values, "areaCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeBetween(Long value1, Long value2) { |
||||||
|
addCriterion("area_code between", value1, value2, "areaCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaCodeNotBetween(Long value1, Long value2) { |
||||||
|
addCriterion("area_code not between", value1, value2, "areaCode"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameIsNull() { |
||||||
|
addCriterion("area_name is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameIsNotNull() { |
||||||
|
addCriterion("area_name is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameEqualTo(String value) { |
||||||
|
addCriterion("area_name =", value, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameNotEqualTo(String value) { |
||||||
|
addCriterion("area_name <>", value, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameGreaterThan(String value) { |
||||||
|
addCriterion("area_name >", value, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameGreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("area_name >=", value, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameLessThan(String value) { |
||||||
|
addCriterion("area_name <", value, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameLessThanOrEqualTo(String value) { |
||||||
|
addCriterion("area_name <=", value, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameLike(String value) { |
||||||
|
addCriterion("area_name like", value, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameNotLike(String value) { |
||||||
|
addCriterion("area_name not like", value, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameIn(List<String> values) { |
||||||
|
addCriterion("area_name in", values, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameNotIn(List<String> values) { |
||||||
|
addCriterion("area_name not in", values, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameBetween(String value1, String value2) { |
||||||
|
addCriterion("area_name between", value1, value2, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andAreaNameNotBetween(String value1, String value2) { |
||||||
|
addCriterion("area_name not between", value1, value2, "areaName"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1IsNull() { |
||||||
|
addCriterion("ext_1 is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1IsNotNull() { |
||||||
|
addCriterion("ext_1 is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1EqualTo(String value) { |
||||||
|
addCriterion("ext_1 =", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1NotEqualTo(String value) { |
||||||
|
addCriterion("ext_1 <>", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1GreaterThan(String value) { |
||||||
|
addCriterion("ext_1 >", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1GreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_1 >=", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1LessThan(String value) { |
||||||
|
addCriterion("ext_1 <", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1LessThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_1 <=", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1Like(String value) { |
||||||
|
addCriterion("ext_1 like", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1NotLike(String value) { |
||||||
|
addCriterion("ext_1 not like", value, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1In(List<String> values) { |
||||||
|
addCriterion("ext_1 in", values, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1NotIn(List<String> values) { |
||||||
|
addCriterion("ext_1 not in", values, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1Between(String value1, String value2) { |
||||||
|
addCriterion("ext_1 between", value1, value2, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt1NotBetween(String value1, String value2) { |
||||||
|
addCriterion("ext_1 not between", value1, value2, "ext1"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2IsNull() { |
||||||
|
addCriterion("ext_2 is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2IsNotNull() { |
||||||
|
addCriterion("ext_2 is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2EqualTo(String value) { |
||||||
|
addCriterion("ext_2 =", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2NotEqualTo(String value) { |
||||||
|
addCriterion("ext_2 <>", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2GreaterThan(String value) { |
||||||
|
addCriterion("ext_2 >", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2GreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_2 >=", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2LessThan(String value) { |
||||||
|
addCriterion("ext_2 <", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2LessThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_2 <=", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2Like(String value) { |
||||||
|
addCriterion("ext_2 like", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2NotLike(String value) { |
||||||
|
addCriterion("ext_2 not like", value, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2In(List<String> values) { |
||||||
|
addCriterion("ext_2 in", values, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2NotIn(List<String> values) { |
||||||
|
addCriterion("ext_2 not in", values, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2Between(String value1, String value2) { |
||||||
|
addCriterion("ext_2 between", value1, value2, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt2NotBetween(String value1, String value2) { |
||||||
|
addCriterion("ext_2 not between", value1, value2, "ext2"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3IsNull() { |
||||||
|
addCriterion("ext_3 is null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3IsNotNull() { |
||||||
|
addCriterion("ext_3 is not null"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3EqualTo(String value) { |
||||||
|
addCriterion("ext_3 =", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3NotEqualTo(String value) { |
||||||
|
addCriterion("ext_3 <>", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3GreaterThan(String value) { |
||||||
|
addCriterion("ext_3 >", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3GreaterThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_3 >=", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3LessThan(String value) { |
||||||
|
addCriterion("ext_3 <", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3LessThanOrEqualTo(String value) { |
||||||
|
addCriterion("ext_3 <=", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3Like(String value) { |
||||||
|
addCriterion("ext_3 like", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3NotLike(String value) { |
||||||
|
addCriterion("ext_3 not like", value, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3In(List<String> values) { |
||||||
|
addCriterion("ext_3 in", values, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3NotIn(List<String> values) { |
||||||
|
addCriterion("ext_3 not in", values, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3Between(String value1, String value2) { |
||||||
|
addCriterion("ext_3 between", value1, value2, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
|
||||||
|
public Criteria andExt3NotBetween(String value1, String value2) { |
||||||
|
addCriterion("ext_3 not between", value1, value2, "ext3"); |
||||||
|
return (Criteria) this; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
*/ |
||||||
|
public static class Criteria extends GeneratedCriteria { |
||||||
|
|
||||||
|
protected Criteria() { |
||||||
|
super(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public static class Criterion { |
||||||
|
private String condition; |
||||||
|
|
||||||
|
private Object value; |
||||||
|
|
||||||
|
private Object secondValue; |
||||||
|
|
||||||
|
private boolean noValue; |
||||||
|
|
||||||
|
private boolean singleValue; |
||||||
|
|
||||||
|
private boolean betweenValue; |
||||||
|
|
||||||
|
private boolean listValue; |
||||||
|
|
||||||
|
private String typeHandler; |
||||||
|
|
||||||
|
public String getCondition() { |
||||||
|
return condition; |
||||||
|
} |
||||||
|
|
||||||
|
public Object getValue() { |
||||||
|
return value; |
||||||
|
} |
||||||
|
|
||||||
|
public Object getSecondValue() { |
||||||
|
return secondValue; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isNoValue() { |
||||||
|
return noValue; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isSingleValue() { |
||||||
|
return singleValue; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isBetweenValue() { |
||||||
|
return betweenValue; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isListValue() { |
||||||
|
return listValue; |
||||||
|
} |
||||||
|
|
||||||
|
public String getTypeHandler() { |
||||||
|
return typeHandler; |
||||||
|
} |
||||||
|
|
||||||
|
protected Criterion(String condition) { |
||||||
|
super(); |
||||||
|
this.condition = condition; |
||||||
|
this.typeHandler = null; |
||||||
|
this.noValue = true; |
||||||
|
} |
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, String typeHandler) { |
||||||
|
super(); |
||||||
|
this.condition = condition; |
||||||
|
this.value = value; |
||||||
|
this.typeHandler = typeHandler; |
||||||
|
if (value instanceof List<?>) { |
||||||
|
this.listValue = true; |
||||||
|
} else { |
||||||
|
this.singleValue = true; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected Criterion(String condition, Object value) { |
||||||
|
this(condition, value, null); |
||||||
|
} |
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { |
||||||
|
super(); |
||||||
|
this.condition = condition; |
||||||
|
this.value = value; |
||||||
|
this.secondValue = secondValue; |
||||||
|
this.typeHandler = typeHandler; |
||||||
|
this.betweenValue = true; |
||||||
|
} |
||||||
|
|
||||||
|
protected Criterion(String condition, Object value, Object secondValue) { |
||||||
|
this(condition, value, secondValue, null); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.hfkj.service; |
||||||
|
|
||||||
|
import com.hfkj.entity.LlgRegion; |
||||||
|
|
||||||
|
/** |
||||||
|
* 零零购地区编码 |
||||||
|
* @className: LlgRegionService |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/1/3 |
||||||
|
**/ |
||||||
|
public interface LlgRegionService { |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据区域编号查询数据 |
||||||
|
* @param areaCode |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
LlgRegion getDataByAreaCode(Long areaCode); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
package com.hfkj.service.impl; |
||||||
|
|
||||||
|
import com.hfkj.dao.LlgRegionMapper; |
||||||
|
import com.hfkj.entity.LlgRegion; |
||||||
|
import com.hfkj.entity.LlgRegionExample; |
||||||
|
import com.hfkj.service.LlgRegionService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import javax.annotation.Resource; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @className: LlgRegionServiceImpl |
||||||
|
* @author: HuRui |
||||||
|
* @date: 2024/1/3 |
||||||
|
**/ |
||||||
|
@Service("llgRegionService") |
||||||
|
public class LlgRegionServiceImpl implements LlgRegionService { |
||||||
|
|
||||||
|
@Resource |
||||||
|
private LlgRegionMapper llgRegionMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public LlgRegion getDataByAreaCode(Long areaCode) { |
||||||
|
LlgRegionExample example = new LlgRegionExample(); |
||||||
|
example.createCriteria().andAreaCodeEqualTo(areaCode); |
||||||
|
List<LlgRegion> list = llgRegionMapper.selectByExample(example); |
||||||
|
if (!list.isEmpty()) { |
||||||
|
return list.get(0); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue