|
@@ -119,21 +119,21 @@ func (ptr *CooperationStatisticsService) PersonCooperationContractStatistics(que |
|
@@ -119,21 +119,21 @@ func (ptr *CooperationStatisticsService) PersonCooperationContractStatistics(que |
119
|
if len(contractUndertakers) == 0 {
|
119
|
if len(contractUndertakers) == 0 {
|
120
|
return response, nil
|
120
|
return response, nil
|
121
|
}
|
121
|
}
|
122
|
- var numbers []string
|
122
|
+ var contractIds []int64
|
123
|
for i := range contractUndertakers {
|
123
|
for i := range contractUndertakers {
|
124
|
- numbers = append(numbers, contractUndertakers[i].CooperationContractNumber)
|
124
|
+ contractIds = append(contractIds, contractUndertakers[i].CooperationContractId)
|
125
|
}
|
125
|
}
|
126
|
- response.ContractSum = ptr.cooperationContractCount(numbers, 0)
|
|
|
127
|
- response.ContractStoppedSum = ptr.cooperationContractCount(numbers, 2)
|
126
|
+ response.ContractSum = ptr.cooperationContractCount(contractIds, 0)
|
|
|
127
|
+ response.ContractStoppedSum = ptr.cooperationContractCount(contractIds, 2)
|
128
|
return response, nil
|
128
|
return response, nil
|
129
|
}
|
129
|
}
|
130
|
|
130
|
|
131
|
-func (ptr *CooperationStatisticsService) cooperationContractCount(numbers []string, status int) int {
|
131
|
+func (ptr *CooperationStatisticsService) cooperationContractCount(contractIds []int64, status int) int {
|
132
|
var total int
|
132
|
var total int
|
133
|
var contract = new(models.CooperationContract)
|
133
|
var contract = new(models.CooperationContract)
|
134
|
query := ptr.transactionContext.PgDd.Model(contract)
|
134
|
query := ptr.transactionContext.PgDd.Model(contract)
|
135
|
query.ColumnExpr("count(*) total")
|
135
|
query.ColumnExpr("count(*) total")
|
136
|
- query.Where("cooperation_contract_number in (?)", pg.In(numbers))
|
136
|
+ query.Where("cooperation_contract_id in (?)", pg.In(contractIds))
|
137
|
if status > 0 {
|
137
|
if status > 0 {
|
138
|
query.Where("status =? ", status)
|
138
|
query.Where("status =? ", status)
|
139
|
}
|
139
|
}
|