diff --git a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/invoice/InvoiceUseService.java b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/invoice/InvoiceUseService.java index 9d4b981..9d896c0 100644 --- a/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/invoice/InvoiceUseService.java +++ b/ssjygl-xsx-common/src/main/java/com/cowr/ssjygl/stat/invoice/InvoiceUseService.java @@ -117,20 +117,12 @@ public class InvoiceUseService { if (invoice_state == 9) { logsql += " and t.state = ? \n"; paramlog.add(invoice_state); - }else if(invoice_state == 5){ + } else if (invoice_state == 5) { ordsql += " and l.state = ? \n"; paramord.add(invoice_state); } } - if (order_state != null) { - logsql += " and o.state = ? \n"; - ordsql += " and t.state = ? \n"; - - paramlog.add(order_state); - paramord.add(order_state); - } - if (invoice_type != null) { logsql += " and t.invoice_type = ? \n"; ordsql += " and t.invoice_type = ? \n"; @@ -141,16 +133,42 @@ public class InvoiceUseService { List list = new ArrayList<>(); - if (invoice_state != null) { - if(invoice_state == 9){ - list = Db.find(logsql + " order by t.create_time", paramlog.toArray()); - }else if(invoice_state == 5){ - list = Db.find(ordsql + " order by t.create_time", paramord.toArray()); - } - } else { - paramlog.addAll(paramord); + if (order_state != null) { + if (order_state == 9) { + logsql += " and o.state = ? \n"; + paramlog.add(order_state); - list = Db.find("select * from (" + logsql + "\n union \n " + ordsql + ") a order by a.create_time ", paramlog.toArray()); + list = Db.find(logsql + " order by t.create_time", paramlog.toArray()); + } else { + logsql += " and o.state = ? \n"; + ordsql += " and t.state = ? \n"; + paramlog.add(order_state); + paramord.add(order_state); + + if (invoice_state != null) { + if (invoice_state == 9) { + list = Db.find(logsql + " order by t.create_time", paramlog.toArray()); + } else if (invoice_state == 5) { + list = Db.find(ordsql + " order by t.create_time", paramord.toArray()); + } + } else { + paramlog.addAll(paramord); + + list = Db.find("select * from (" + logsql + "\n union \n " + ordsql + ") a order by a.create_time ", paramlog.toArray()); + } + } + }else { + if (invoice_state != null) { + if (invoice_state == 9) { + list = Db.find(logsql + " order by t.create_time", paramlog.toArray()); + } else if (invoice_state == 5) { + list = Db.find(ordsql + " order by t.create_time", paramord.toArray()); + } + } else { + paramlog.addAll(paramord); + + list = Db.find("select * from (" + logsql + "\n union \n " + ordsql + ") a order by a.create_time ", paramlog.toArray()); + } } Record out = new Record();