Commit 0dd9fd18 by 王勇飞

Merge branch 'center-manage' of gitlab.gongsibao.com:jiangyong/zhichan into center-manage

parents ca46cf8a 8e81b9fa
...@@ -177,7 +177,13 @@ class Dao { ...@@ -177,7 +177,13 @@ class Dao {
qcwhere["attributes"] = {}; qcwhere["attributes"] = {};
qcwhere["attributes"] = aggArray; qcwhere["attributes"] = aggArray;
qcwhere["raw"] = true; qcwhere["raw"] = true;
var aggResult = await this.model.findOne(qcwhere); //提高效率去掉关联和排序,数据记录数量,为聚合
let tmpwhere={
attributes:qcwhere.attributes,
raw:true,
where:qcwhere.where
}
var aggResult = await this.model.findOne(tmpwhere);
return aggResult; return aggResult;
} else { } else {
return {}; return {};
...@@ -186,10 +192,14 @@ class Dao { ...@@ -186,10 +192,14 @@ class Dao {
} }
async findAndCountAll(qobj, t) { async findAndCountAll(qobj, t) {
var qc = this.buildQuery(qobj); var qc = this.buildQuery(qobj);
var apps = await this.model.findAndCountAll(qc); let findList={}
let count=await this.findCount({where:qc.where})
var rows = await this.model.findAll(qc);
findList["count"]=count
findList["rows"]=rows
var aggresult = await this.findAggs(qobj, qc); var aggresult = await this.findAggs(qobj, qc);
var rtn = {}; var rtn = {};
rtn.results = apps; rtn.results = findList;
rtn.aggresult = aggresult; rtn.aggresult = aggresult;
return rtn; return rtn;
} }
......
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