wuwenxiong 2021-09-17 09:49:52 +08:00
commit 20d8f00674
1 changed files with 6 additions and 1 deletions

View File

@ -2006,10 +2006,15 @@ public class OrderStatService {
} }
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
String cidsql = "";
for (Record r : customer_sale_list) { for (Record r : customer_sale_list) {
ids.add(r.getStr("customer_id")); ids.add(r.getStr("customer_id"));
} }
if(!ids.isEmpty()){
cidsql = " c.id in(" + StrKit.join(ids, ",") + ") or ";
}
List<Record> customer_pre_list = Db.find("select\n" + List<Record> customer_pre_list = Db.find("select\n" +
" a.customer_id,\n" + " a.customer_id,\n" +
" tp.id customer_type_id,\n" + " tp.id customer_type_id,\n" +
@ -2027,7 +2032,7 @@ public class OrderStatService {
" ) a on c.id = a.customer_id \n" + " ) a on c.id = a.customer_id \n" +
" left join customer_type tp on tp.id = c.customer_type_id\n" + " left join customer_type tp on tp.id = c.customer_type_id\n" +
" left join prepay_customer p on p.customer_id = c.id\n" + " left join prepay_customer p on p.customer_id = c.id\n" +
" where c.id in(" + StrKit.join(ids, ",") + ") or a.customer_id is not null \n" + // 查询时间段内有购砂、起始时间年内有充值的 " where " + cidsql + " a.customer_id is not null \n" + // 查询时间段内有购砂、起始时间年内有充值的
" union\n" + " union\n" +
" select 0 customer_id, 99 customer_type_id, '零散' customer_type_name, '零散客户' customer_name, '零散客户' name, null prepay_total_amount, null prepay_surplus", tm); " select 0 customer_id, 99 customer_type_id, '零散' customer_type_name, '零散客户' customer_name, '零散客户' name, null prepay_total_amount, null prepay_surplus", tm);