Commit 92bf451b by 孙亚楠

dd

parent f182c06a
...@@ -182,11 +182,21 @@ class StOrderItemDao extends Dao { ...@@ -182,11 +182,21 @@ class StOrderItemDao extends Dao {
if (params.unInvoice) { if (params.unInvoice) {
sql.push("AND saas_invoice_id = ''"); sql.push("AND saas_invoice_id = ''");
} }
if (params.saas_invoice_id) {
sql.push("AND saas_invoice_id = :saas_invoice_id");
}
if(params.data_ids && params.data_ids.length>0){
sql.push("AND id in (:data_ids)");
}
} }
async invoiceTrade(id,order_type){ async invoiceTrade(params){
let sql = `select * from st_order_item where saas_invoice_id =:id and order_type =:order_type`; let sql = [];
return await this.customQuery(sql, {id:id,order_type:order_type}); sql.push(`select * from st_order_item `);
sql.push("WHERE deleted_at IS NULL and 1=1 ");
this.setCondition(sql, params);
sql.push("ORDER BY created_at DESC");
return await this.customQuery(sql.join(" "), params);
} }
......
...@@ -109,7 +109,15 @@ class StOrderItemService extends ServiceBase { ...@@ -109,7 +109,15 @@ class StOrderItemService extends ServiceBase {
return system.getResult(null,`订单类型不能为空`); return system.getResult(null,`订单类型不能为空`);
} }
try { try {
let res = await this.dao.invoiceTrade(this.trim(params.id),this.trim(params.order_type)) || []; let tparam = {order_type:this.trim(params.order_type)};
if (params.data_ids && params.data_ids.length > 0) {
tparam.data_ids = params.data_ids;
} else if (params.id) {
tparam.saas_invoice_id = params.id;
} else {
return system.getResult([]);
}
let res = await this.dao.invoiceTrade(tparam) || [];
for(let item of res){ for(let item of res){
this.handleDate(item, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss'); this.handleDate(item, ['updated_at', 'created_at'], 'YYYY-MM-DD HH:mm:ss');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment