作者 yangfu

分红预算列表

... ... @@ -84,7 +84,7 @@ func (dao *CreditAccountDao) CooperationUsersDividendsStatistics(queryOptions ma
query.ColumnExpr(`sum((case when payment_status = 1 then actually_paid_amount else 0 end)) actually_paid_amount`)
query.ColumnExpr(`max(participator->>'userId') user_id`)
query.ColumnExpr(`max(participator#>>'{userInfo,userName}') user_name`)
if _, ok := queryOptions["beginTime"]; ok {
if _, ok := queryOptions["beginTime"]; ok && !queryOptions["beginTime"].(time.Time).IsZero() {
query.Where(`created_at>? `, queryOptions["beginTime"])
query.Where(`created_at<? `, queryOptions["endTime"])
}
... ...
... ... @@ -30,7 +30,7 @@ func (dao *OrderGoodDao) CooperationGoodsStatistics(queryOptions map[string]inte
queryLimit = fmt.Sprintf("limit %v", queryOptions["limit"])
}
sql := fmt.Sprintf(`select order_good_name good_name,sum(order_good_amount) good_amount from order_goods
where company_id=? and org_id = ? %v
where company_id=? and org_id = ? and deleted_at is null %v
GROUP BY order_good_name
order by good_amount desc
%v
... ... @@ -49,7 +49,7 @@ func (dao *OrderGoodDao) CooperationCompanyModeStatistics(queryOptions map[strin
var goods []*domain.CooperationModeStatisticsDto
sql := fmt.Sprintf(`select count(0) cooperation_people,sum(a.actually_paid_amount) dividends_estimate,b.cooperation_mode_number,sum(good_amount_count) order_amount
from credit_accounts a inner join cooperation_contracts b on a.cooperation_contract_number = b.cooperation_contract_number
where a.company->>'companyId' = '?' and a.org->>'orgId' = '?' and b.status = 1
where a.company->>'companyId' = '?' and a.org->>'orgId' = '?' and a.deleted_at is null and b.status = 1
group by b.cooperation_mode_number
`)
_, err := tx.Query(&goods, sql, queryOptions["companyId"], queryOptions["orgId"])
... ...