|
|
|
@ -236,7 +236,6 @@ class BaseModelSqlv2 {
|
|
|
|
|
const aliasColObjMap = await this.model.getAliasColObjMap(); |
|
|
|
|
const filterObj = extractFilterFromXwhere(where, aliasColObjMap); |
|
|
|
|
|
|
|
|
|
// todo: replace with view id
|
|
|
|
|
if (!ignoreFilterSort && this.viewId) { |
|
|
|
|
await conditionV2( |
|
|
|
|
[ |
|
|
|
@ -320,7 +319,7 @@ class BaseModelSqlv2 {
|
|
|
|
|
|
|
|
|
|
const childQb = this.dbDriver.queryBuilder().from( |
|
|
|
|
this.dbDriver |
|
|
|
|
.union( |
|
|
|
|
.unionAll( |
|
|
|
|
ids.map(p => { |
|
|
|
|
const query = qb |
|
|
|
|
.clone() |
|
|
|
@ -396,7 +395,6 @@ class BaseModelSqlv2 {
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
return children.map(({ count }) => count); |
|
|
|
|
// return _.groupBy(children, cn);
|
|
|
|
|
} catch (e) { |
|
|
|
|
console.log(e); |
|
|
|
|
throw e; |
|
|
|
@ -528,7 +526,7 @@ class BaseModelSqlv2 {
|
|
|
|
|
const qb = this.dbDriver(rtn).join(vtn, `${vtn}.${vrcn}`, `${rtn}.${rcn}`); |
|
|
|
|
|
|
|
|
|
await childModel.selectObject({ qb }); |
|
|
|
|
const finalQb = this.dbDriver.union( |
|
|
|
|
const finalQb = this.dbDriver.unionAll( |
|
|
|
|
parentIds.map(id => { |
|
|
|
|
const query = qb |
|
|
|
|
.clone() |
|
|
|
@ -636,7 +634,7 @@ class BaseModelSqlv2 {
|
|
|
|
|
.count(`${vtn}.${vcn}`, { as: 'count' }); |
|
|
|
|
|
|
|
|
|
// await childModel.selectObject({ qb });
|
|
|
|
|
const children = await this.dbDriver.union( |
|
|
|
|
const children = await this.dbDriver.unionAll( |
|
|
|
|
parentIds.map(id => { |
|
|
|
|
const query = qb |
|
|
|
|
.clone() |
|
|
|
|