作者 yangfu

分红预算列表

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