作者 yangfu

索引优化

... ... @@ -157,10 +157,10 @@ func (dao *DividendsEstimateDao) CountDividendsEstimateDividendsAmount(queryOpti
query := tx.Model(&dividendsEstimateModels)
query.ColumnExpr("sum(dividends_amount) amount")
if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
query = query.Where(`dividends_estimate.company @> '{"companyId":"?"}'`, companyId)
query = query.Where(`dividends_estimate.company->>'companyId'='?'`, companyId)
}
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query = query.Where(`dividends_estimate.org @> '{"orgId":"?"}'`, orgId)
query = query.Where(`dividends_estimate.org->>'orgId'='?'`, orgId)
}
if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
query = query.Where(`dividends_user->>'userBaseId'='?'`, userBaseId)
... ...