|
|
@ -1072,7 +1072,9 @@ class BaseModelSqlv2 { |
|
|
|
return parentIds.map((id) => gs?.[id]?.[0] || []); |
|
|
|
return parentIds.map((id) => gs?.[id]?.[0] || []); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public async mmListCount({ colId, parentId }) { |
|
|
|
public async mmListCount({ colId, parentId }, args) { |
|
|
|
|
|
|
|
const { where } = this._getListArgs(args as any); |
|
|
|
|
|
|
|
|
|
|
|
const relColumn = (await this.model.getColumns()).find( |
|
|
|
const relColumn = (await this.model.getColumns()).find( |
|
|
|
(c) => c.id === colId, |
|
|
|
(c) => c.id === colId, |
|
|
|
); |
|
|
|
); |
|
|
@ -1106,12 +1108,12 @@ class BaseModelSqlv2 { |
|
|
|
.select(cn) |
|
|
|
.select(cn) |
|
|
|
// .where(parentTable.primaryKey.cn, id)
|
|
|
|
// .where(parentTable.primaryKey.cn, id)
|
|
|
|
.where(_wherePk(parentTable.primaryKeys, parentId)), |
|
|
|
.where(_wherePk(parentTable.primaryKeys, parentId)), |
|
|
|
) |
|
|
|
); |
|
|
|
.first(); |
|
|
|
const aliasColObjMap = await childTable.getAliasColObjMap(); |
|
|
|
|
|
|
|
const filterObj = extractFilterFromXwhere(where, aliasColObjMap); |
|
|
|
const { count } = await qb; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return count; |
|
|
|
await conditionV2(this, filterObj, qb); |
|
|
|
|
|
|
|
return (await qb.first())?.count; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// todo: naming & optimizing
|
|
|
|
// todo: naming & optimizing
|
|
|
|