Browse Source

分表相关

MaiXinRong 4 years ago
parent
commit
9c54d7f569

+ 1 - 1
app/base/base_bills_service.js

@@ -470,7 +470,7 @@ class BaseBillsSerivce extends TreeService {
 
     // 统计方法
     async addUp(condition) {
-        if (!condition.tender_id) throw  new TypeError('统计计算缺少必要数据');
+        if (!condition.tender_id) throw new TypeError('statistical lacks necessary parameter');
         const sql = 'SELECT Sum(total_price) As total_price, Sum(deal_tp) As deal_tp' +
             '  FROM ' + this.departTableName(condition.tender_id) + this.ctx.helper.whereSql(condition);
         const result = await this.db.queryOne(sql);

+ 4 - 2
app/base/base_service.js

@@ -47,12 +47,14 @@ class BaseService extends Service {
     get tableName() {
         if (this.depart <= 0) return this._table;
 
-        if (!this.ctx.tender) throw  new TypeError('统计计算缺少必要数据');
+        if (!this.ctx.tender) throw  new TypeError('tableName error: Without Tender');
         return this._table + '_' + (this.ctx.tender.id % this.depart);
     }
 
     departTableName(key) {
-        if (this.depart <= 0 || !key) throw  new TypeError('统计计算缺少必要数据');
+        if (this.depart <= 0) return this._table;
+
+        if (!key) throw  new TypeError('tableName error: Without DepartKey');
         return this._table + '_' + (key % this.depart);
     }
 

+ 1 - 0
app/controller/standard_lib_controller.js

@@ -34,6 +34,7 @@ module.exports = app => {
                         throw '查询的标准清单不存在';
                 }
             } catch (error) {
+                this.log(error);
                 responseData.err = 1;
                 responseData.msg = error;
             }