MaiXinRong 3 年之前
父节点
当前提交
a08be545d0
共有 1 个文件被更改,包括 8 次插入7 次删除
  1. 8 7
      app/service/stage_bills.js

+ 8 - 7
app/service/stage_bills.js

@@ -105,21 +105,22 @@ module.exports = app => {
         }
 
         async getLastestStageData2(tid, sid, lid) {
-            const condition = { tender_id: tid, sid, lid };
-            if (!lid) delete condition.lid;
+            const filterSql = lid ? this._getFilterSql({lid}) : '';
+            const sql = 'Select * From ' + this.departTableName(tid) +
+                '  Where tid = ? and sid = ? ' + filterSql;
 
-            const result = this.db.select(this.departTableName(tid), { where: condition });
+            const result = await this.db.query(sql, [tid, sid]);
             const stageBills = this.ctx.helper.filterLastestData(result, 'lid');
             if (!lid || lid instanceof Array) return stageBills;
             return stageBills[0];
         }
 
-        async getAuditorStageData2(tid, sid, times, order, where) {
-            const filterSql = this._getFilterSql(where);
+        async getAuditorStageData2(tid, sid, times, order, lid) {
+            const filterSql = lid ? this._getFilterSql({lid}) : '';
             const sql = 'Select * From ' + this.departTableName(tid) +
-                        '  Where tender_id = ? and sid = ? And (`times` < ? OR (`times` = ? AND `order` <= ?)) ' + filterSql;
+                        '  Where tid = ? and sid = ? And (`times` < ? OR (`times` = ? AND `order` <= ?)) ' + filterSql;
 
-            const result = this.db.query(sql, [tid, sid, times, times, order]);
+            const result = await this.db.query(sql, [tid, sid, times, times, order]);
             const stageBills = this.ctx.helper.filterLastestData(result, 'lid');
             if (!lid || lid instanceof Array) return stageBills;
             return stageBills[0];