String sql="select daily.region,daily.cust_id,daily.case_id,claim.claim_no,claim.claim_no_3rd,\r\n" +
"claim.vin,claim.plate_no,claim.mf_code,claim.model_code,sub_model_code,\r\n" +
"vin_count,preview_count,calculation_count,transaction_count,billing_date \r\n" +
"from billing_log_daily daily,billing_claim_info claim \r\n" +
"where daily.region=@regionInfo and daily.cust_id=@cust_id \r\n" +
"and daily.case_id=claim.case_id\r\n" +
"and daily.cust_id=claim.cust_id\r\n" +
"and daily.region=claim.region \r\n" +
"and daily.billing_date between @StartDate and @EndDate ";
Sql sqlsearch=Sqls.create(sql);
sqlsearch.params().set("regionInfo",regionInfo);
sqlsearch.params().set("cust_id",cust_id.trim());
sqlsearch.params().set("StartDate",StartDate);
sqlsearch.params().set("EndDate",EndDate);
sqlsearch.setCallback(new SqlCallback() {
@Override
public Object invoke(Connection conn, ResultSet result, Sql sql) throws SQLException {
Map<String, String> map=new HashMap<>();
map.put("region",result.getString("region"));
map.put("cust_id",result.getString("cust_id"));
map.put("case_id",result.getString("case_id"));
map.put("clain_no",result.getString("clain_no"));
map.put("claim_no_3rd",result.getString("claim_no_3rd"));
map.put("vin",result.getString("vin"));
map.put("plate_no",result.getString("plate_no"));
map.put("mf_code",result.getString("mf_code"));
map.put("model_code",result.getString("model_code"));
map.put("sub_model_code",result.getString("sub_model_code"));
map.put("vin_count",result.getString("vin_count"));
map.put("preview_count",result.getString("preview_count"));
map.put("calculation_count",result.getString("calculation_count"));
map.put("transaction_count",result.getString("transaction_count"));
map.put("billing_date",result.getString("billing_date"));
Iterator<Map.Entry<String,String>> entries = map.entrySet().iterator();
while (entries.hasNext()) {
Map.Entry<String,String> entry = entries.next();
System.out.println("Key = " + entry.getKey() + ", Value = " + entry.getValue());
}
return null;
}
});
dao.execute(sqlsearch);