作者 yangfu

共创用户明细

@@ -45,6 +45,10 @@ func (svr *CooperationStatisticsService) CooperationContractStatistics(contractS @@ -45,6 +45,10 @@ func (svr *CooperationStatisticsService) CooperationContractStatistics(contractS
45 res, err = statisticsService.CompanyDividendsStatistics(contractStatisticsQuery.QueryOptions) 45 res, err = statisticsService.CompanyDividendsStatistics(contractStatisticsQuery.QueryOptions)
46 case domain_service.CompanyCooperationUsersStatistics: 46 case domain_service.CompanyCooperationUsersStatistics:
47 res, err = statisticsService.CompanyCooperationUsersStatistics(contractStatisticsQuery.QueryOptions) 47 res, err = statisticsService.CompanyCooperationUsersStatistics(contractStatisticsQuery.QueryOptions)
  48 + case domain_service.CompanyPaymentHistoryStatistics:
  49 + res, err = statisticsService.CompanyPaymentHistoryStatistics(contractStatisticsQuery.QueryOptions)
  50 + case domain_service.CooperationUserModeStatistics:
  51 + res, err = statisticsService.CooperationUserModeStatistics(contractStatisticsQuery.QueryOptions)
48 case domain_service.DividendsStatistics: 52 case domain_service.DividendsStatistics:
49 res, err = statisticsService.DividendsStatistics(contractStatisticsQuery.QueryOptions) 53 res, err = statisticsService.DividendsStatistics(contractStatisticsQuery.QueryOptions)
50 case domain_service.SearchDividendsEstimates: 54 case domain_service.SearchDividendsEstimates:
@@ -53,6 +57,8 @@ func (svr *CooperationStatisticsService) CooperationContractStatistics(contractS @@ -53,6 +57,8 @@ func (svr *CooperationStatisticsService) CooperationContractStatistics(contractS
53 res, err = statisticsService.CooperationCompanyStatistics(contractStatisticsQuery.QueryOptions) 57 res, err = statisticsService.CooperationCompanyStatistics(contractStatisticsQuery.QueryOptions)
54 case domain_service.PersonCooperationContractStatistics: 58 case domain_service.PersonCooperationContractStatistics:
55 res, err = statisticsService.PersonCooperationContractStatistics(contractStatisticsQuery.QueryOptions) 59 res, err = statisticsService.PersonCooperationContractStatistics(contractStatisticsQuery.QueryOptions)
  60 + case domain_service.CreditAccountStatistics:
  61 + res, err = statisticsService.CreditAccountStatistics(contractStatisticsQuery.QueryOptions)
56 } 62 }
57 if err != nil { 63 if err != nil {
58 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 64 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
@@ -21,8 +21,8 @@ type CooperationModeStatisticsDto struct { @@ -21,8 +21,8 @@ type CooperationModeStatisticsDto struct {
21 OrderAmount float64 `json:"orderAmount"` 21 OrderAmount float64 `json:"orderAmount"`
22 // 共创模式编号 22 // 共创模式编号
23 CooperationModeNumber string `json:"cooperationModeNumber"` 23 CooperationModeNumber string `json:"cooperationModeNumber"`
24 - // 共创模式  
25 - // cooperationMode *CooperationMode 24 + // 结算金额
  25 + SettlementAmount float64 `json:"settlementAmount"`
26 } 26 }
27 27
28 type DividendStatisticsDto struct { 28 type DividendStatisticsDto struct {
@@ -60,7 +60,7 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa @@ -60,7 +60,7 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa
60 query.ColumnExpr(`sum(settlement_amount) total`) 60 query.ColumnExpr(`sum(settlement_amount) total`)
61 query.ColumnExpr(`sum((case when payment_status = 1 then actually_paid_amount else 0 end)) paid`) 61 query.ColumnExpr(`sum((case when payment_status = 1 then actually_paid_amount else 0 end)) paid`)
62 query.ColumnExpr(`sum((case when settlement_time is not null then settlement_amount else 0 end)) accounted `) 62 query.ColumnExpr(`sum((case when settlement_time is not null then settlement_amount else 0 end)) accounted `)
63 - if _, ok := queryOptions["beginTime"]; ok { 63 + if v, ok := queryOptions["beginTime"]; ok && !(v.(time.Time).IsZero()) {
64 query.Where(`created_at>? `, queryOptions["beginTime"]) 64 query.Where(`created_at>? `, queryOptions["beginTime"])
65 query.Where(`created_at<? `, queryOptions["endTime"]) 65 query.Where(`created_at<? `, queryOptions["endTime"])
66 } 66 }
@@ -94,6 +94,15 @@ func (dao *CreditAccountDao) CooperationUsersDividendsStatistics(queryOptions ma @@ -94,6 +94,15 @@ func (dao *CreditAccountDao) CooperationUsersDividendsStatistics(queryOptions ma
94 if v, ok := queryOptions["orgId"]; ok && v.(int64) > 0 { 94 if v, ok := queryOptions["orgId"]; ok && v.(int64) > 0 {
95 query.Where(fmt.Sprintf(` org->>'orgId'= '%v'`, v)) 95 query.Where(fmt.Sprintf(` org->>'orgId'= '%v'`, v))
96 } 96 }
  97 + if v, ok := queryOptions["paymentStatus"]; ok && v.(int32) > 0 {
  98 + query.Where("paymentStatus = ?", v)
  99 + }
  100 + if v, ok := queryOptions["beginTime"]; ok && !v.(time.Time).IsZero() {
  101 + query.Where("created_at >= ?", v)
  102 + }
  103 + if v, ok := queryOptions["endTime"]; ok && !v.(time.Time).IsZero() {
  104 + query.Where("created_at < ?", v)
  105 + }
97 query.Where("deleted_at is null") 106 query.Where("deleted_at is null")
98 if v, ok := queryOptions["sortByActuallyPaidAmount"]; ok { 107 if v, ok := queryOptions["sortByActuallyPaidAmount"]; ok {
99 vInt := v.(int) 108 vInt := v.(int)
@@ -103,7 +112,7 @@ func (dao *CreditAccountDao) CooperationUsersDividendsStatistics(queryOptions ma @@ -103,7 +112,7 @@ func (dao *CreditAccountDao) CooperationUsersDividendsStatistics(queryOptions ma
103 query.Order("divides_amount desc") 112 query.Order("divides_amount desc")
104 } 113 }
105 } 114 }
106 - query.GroupExpr("participator->>'userBaseId'") 115 + query.GroupExpr("participator->>'userId'")
107 query.Limit(queryOptions["limit"].(int)) 116 query.Limit(queryOptions["limit"].(int))
108 query.Offset(queryOptions["offset"].(int)) 117 query.Offset(queryOptions["offset"].(int))
109 err := query.Select(v) 118 err := query.Select(v)
@@ -4,6 +4,7 @@ import ( @@ -4,6 +4,7 @@ import (
4 "fmt" 4 "fmt"
5 pgTransaction "github.com/linmadan/egglib-go/transaction/pg" 5 pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 6 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
7 "time" 8 "time"
8 ) 9 )
9 10
@@ -38,12 +39,12 @@ order by good_amount desc @@ -38,12 +39,12 @@ order by good_amount desc
38 return goods, err 39 return goods, err
39 } 40 }
40 41
41 -// CooperationModeStatistics 共创模式统计 42 +// CooperationCompanyModeStatistics 共创模式统计
42 // 43 //
43 // queryOptions 查询参数 44 // queryOptions 查询参数
44 // - companyId 企业Id 45 // - companyId 企业Id
45 // - orgId 组织Id 46 // - orgId 组织Id
46 -func (dao *OrderGoodDao) CooperationModeStatistics(queryOptions map[string]interface{}) ([]*domain.CooperationModeStatisticsDto, error) { 47 +func (dao *OrderGoodDao) CooperationCompanyModeStatistics(queryOptions map[string]interface{}) ([]*domain.CooperationModeStatisticsDto, error) {
47 tx := dao.transactionContext.PgTx 48 tx := dao.transactionContext.PgTx
48 var goods []*domain.CooperationModeStatisticsDto 49 var goods []*domain.CooperationModeStatisticsDto
49 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
@@ -55,6 +56,30 @@ group by b.cooperation_mode_number @@ -55,6 +56,30 @@ group by b.cooperation_mode_number
55 return goods, err 56 return goods, err
56 } 57 }
57 58
  59 +// 共创用户模式统计
  60 +func (dao *OrderGoodDao) CooperationUserModeStatistics(queryOptions map[string]interface{}) ([]*domain.CooperationModeStatisticsDto, error) {
  61 + tx := dao.transactionContext.PgTx
  62 + var goods []*domain.CooperationModeStatisticsDto
  63 + creditAccount := new(models.CreditAccount)
  64 + query := tx.Model(creditAccount)
  65 + query.ColumnExpr("count(0) cooperation_people")
  66 + query.ColumnExpr("sum(actually_paid_amount) dividends_estimate")
  67 + query.ColumnExpr("sum(good_amount_count) order_amount")
  68 + query.ColumnExpr("sum(actually_paid_amount) settlement_amount")
  69 + query.ColumnExpr("a.cooperation_mode_number cooperation_mode_number")
  70 + query.Join("inner join cooperation_contracts as a").JoinOn("a.cooperation_contract_number = credit_account.cooperation_contract_number")
  71 + if v, ok := queryOptions["userId"]; ok && v.(int64) > 0 {
  72 + query.Where(fmt.Sprintf(`credit_account.participator->>'userId'='%v' `, v))
  73 + }
  74 + if v, ok := queryOptions["orgId"]; ok && v.(int64) > 0 {
  75 + query.Where(fmt.Sprintf(` org->>'orgId'= '%v'`, v))
  76 + }
  77 + query.Where("credit_account.deleted_at is null")
  78 + query.Group("cooperation_mode_number")
  79 + err := query.Select(&goods)
  80 + return goods, err
  81 +}
  82 +
58 // DividendsStatistics 企业分红统计 83 // DividendsStatistics 企业分红统计
59 // 84 //
60 // queryOptions 查询参数 85 // queryOptions 查询参数
@@ -7,6 +7,7 @@ import ( @@ -7,6 +7,7 @@ import (
7 "github.com/linmadan/egglib-go/utils/tool_funs" 7 "github.com/linmadan/egglib-go/utils/tool_funs"
8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain" 8 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao" 9 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/dao"
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/repository"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils" 11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
11 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/log"
12 "math" 13 "math"
@@ -91,7 +92,7 @@ func (ptr *CooperationStatisticsService) CooperationModeStatistics(queryOptions @@ -91,7 +92,7 @@ func (ptr *CooperationStatisticsService) CooperationModeStatistics(queryOptions
91 } 92 }
92 queryOptions = tool_funs.SimpleStructToMap(&request) 93 queryOptions = tool_funs.SimpleStructToMap(&request)
93 94
94 - modeStatistics, err := orderGoodDao.CooperationModeStatistics(queryOptions) 95 + modeStatistics, err := orderGoodDao.CooperationCompanyModeStatistics(queryOptions)
95 if err != nil { 96 if err != nil {
96 return nil, err 97 return nil, err
97 } 98 }
@@ -201,18 +202,7 @@ func (ptr *CooperationStatisticsService) CompanyCooperationUsersStatistics(query @@ -201,18 +202,7 @@ func (ptr *CooperationStatisticsService) CompanyCooperationUsersStatistics(query
201 } 202 }
202 queryOptions = tool_funs.SimpleStructToMap(&request) 203 queryOptions = tool_funs.SimpleStructToMap(&request)
203 204
204 - type response struct {  
205 - CooperationTime int64 `json:"cooperationTime"`  
206 - DividendsOrderAmount float64 `json:"dividendsOrderAmount"`  
207 - DividesAmount float64 `json:"dividesAmount"` // 分红金额  
208 - ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` // 已支付金额  
209 - UnPaidAmount float64 `json:"unPaidAmount"` // 未支付金额  
210 - UserId int64 `json:"userId,string"`  
211 - UserName string `json:"userName"`  
212 -  
213 - Participator interface{} `json:"participator"`  
214 - }  
215 - var responses []response 205 + var responses []usersStatisticsResponse
216 creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext) 206 creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
217 if err := creditAccountDao.CooperationUsersDividendsStatistics(queryOptions, &responses); err != nil { 207 if err := creditAccountDao.CooperationUsersDividendsStatistics(queryOptions, &responses); err != nil {
218 return nil, err 208 return nil, err
@@ -238,3 +228,122 @@ func (ptr *CooperationStatisticsService) CompanyCooperationUsersStatistics(query @@ -238,3 +228,122 @@ func (ptr *CooperationStatisticsService) CompanyCooperationUsersStatistics(query
238 228
239 return retMap, nil 229 return retMap, nil
240 } 230 }
  231 +
  232 +type usersStatisticsResponse struct {
  233 + CooperationTime int64 `json:"cooperationTime"`
  234 + DividendsOrderAmount float64 `json:"dividendsOrderAmount"`
  235 + DividesAmount float64 `json:"dividesAmount"` // 分红金额
  236 + ActuallyPaidAmount float64 `json:"actuallyPaidAmount"` // 已支付金额
  237 + UnPaidAmount float64 `json:"unPaidAmount"` // 未支付金额
  238 + UserId int64 `json:"userId,string"`
  239 + UserName string `json:"userName"`
  240 +
  241 + Participator interface{} `json:"participator"`
  242 +}
  243 +
  244 +// 公司 - 共创用户模式统计
  245 +func (ptr *CooperationStatisticsService) CooperationUserModeStatistics(queryOptions map[string]interface{}) (interface{}, error) {
  246 + // 参数验证
  247 + var request = struct {
  248 + UserId int64 `json:"offset" valid:"Required"`
  249 + //OrgId int64 `json:"orgId" valid:"Required"`
  250 + }{}
  251 + if err := LoadQueryObject(queryOptions, &request); err != nil {
  252 + return nil, err
  253 + }
  254 + queryOptions = tool_funs.SimpleStructToMap(&request)
  255 +
  256 + orderGoodDao, _ := dao.NewOrderGoodDao(ptr.transactionContext)
  257 + modeStatistics, err := orderGoodDao.CooperationUserModeStatistics(queryOptions)
  258 + if err != nil {
  259 + return nil, err
  260 + }
  261 + if len(modeStatistics) == 0 {
  262 + return struct{}{}, nil
  263 + }
  264 +
  265 + var modeNumbers []string
  266 + var mapModeStatistics = make(map[string]*domain.CooperationModeStatisticsDto)
  267 + for i := range modeStatistics {
  268 + mapModeStatistics[modeStatistics[i].CooperationModeNumber] = modeStatistics[i]
  269 + modeNumbers = append(modeNumbers, modeStatistics[i].CooperationModeNumber)
  270 + }
  271 +
  272 + cooperationModeRepository, _ := repository.NewCooperationModeRepository(ptr.transactionContext)
  273 + _, cooperModes, err := cooperationModeRepository.Find(map[string]interface{}{"cooperationModeNumbers": modeNumbers})
  274 + if err != nil {
  275 + return nil, err
  276 + }
  277 + var cooperationTypes, dividendsExpenseByTypes, orderAmountByTypes []interface{}
  278 + var totalOrderAmount float64
  279 + var totalDividendAmount float64
  280 + for i := range cooperModes {
  281 + m := cooperModes[i]
  282 + if modeStatistics, ok := mapModeStatistics[m.CooperationModeNumber]; ok {
  283 + totalOrderAmount += modeStatistics.OrderAmount
  284 + totalDividendAmount += modeStatistics.SettlementAmount
  285 + dividendsExpenseByTypes = append(dividendsExpenseByTypes, map[string]interface{}{
  286 + "dividendsTypeName": m.CooperationModeName + "分红支出",
  287 + "dividendsExpense": modeStatistics.SettlementAmount,
  288 + })
  289 + orderAmountByTypes = append(orderAmountByTypes, map[string]interface{}{
  290 + "orderAmount": modeStatistics.OrderAmount,
  291 + "orderTypeName": m.CooperationModeName + "成交订单",
  292 + })
  293 + }
  294 + cooperationTypes = append(cooperationTypes, map[string]interface{}{
  295 + "cooperationModeId": m.CooperationModeId,
  296 + "cooperationModeName": m.CooperationModeName,
  297 + "cooperationModeNumber": m.CooperationModeNumber,
  298 + })
  299 + }
  300 + return map[string]interface{}{
  301 + "cooperationTypes": cooperationTypes,
  302 + "dividendsDetails": map[string]interface{}{
  303 + "dividendsExpense": totalDividendAmount,
  304 + "dividendsExpenseByTypes": dividendsExpenseByTypes,
  305 + },
  306 + "orderDetails": map[string]interface{}{
  307 + "orderAmount": totalOrderAmount,
  308 + "orderAmountByTypes": orderAmountByTypes,
  309 + },
  310 + }, nil
  311 +}
  312 +
  313 +// 公司 - 共创用户分红支付统计
  314 +func (ptr *CooperationStatisticsService) CompanyPaymentHistoryStatistics(queryOptions map[string]interface{}) (interface{}, error) {
  315 + // 参数验证
  316 + var request = struct {
  317 + Limit int `json:"limit" valid:"Required"`
  318 + Offset int `json:"offset"`
  319 + OrgId int64 `json:"orgId" valid:"Required"`
  320 + SortByActuallyPaidAmount int `json:"sortByActuallyPaidAmount" valid:"Required"`
  321 + BeginTime time.Time `json:"beginTime"`
  322 + EndTime time.Time `json:"endTime"`
  323 + }{}
  324 + if err := LoadQueryObject(queryOptions, &request); err != nil {
  325 + return nil, err
  326 + }
  327 + queryOptions = tool_funs.SimpleStructToMap(&request)
  328 +
  329 + var responses []usersStatisticsResponse
  330 + creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
  331 + if err := creditAccountDao.CooperationUsersDividendsStatistics(queryOptions, &responses); err != nil {
  332 + return nil, err
  333 + }
  334 +
  335 + var retMap = make([]interface{}, 0)
  336 + for i := range responses {
  337 + retMap = append(retMap, map[string]interface{}{
  338 + "paymentAmount": responses[i].ActuallyPaidAmount,
  339 + "user": map[string]interface{}{
  340 + "userId": responses[i].UserId,
  341 + "userInfo": map[string]interface{}{
  342 + "userName": responses[i].UserName,
  343 + },
  344 + },
  345 + })
  346 + }
  347 +
  348 + return retMap, nil
  349 +}
@@ -32,11 +32,18 @@ const ( @@ -32,11 +32,18 @@ const (
32 SearchDividendsEstimates = "SearchDividendsEstimates" 32 SearchDividendsEstimates = "SearchDividendsEstimates"
33 // 公司 - 共创用户统计 33 // 公司 - 共创用户统计
34 CompanyCooperationUsersStatistics = "CompanyCooperationUsersStatistics" 34 CompanyCooperationUsersStatistics = "CompanyCooperationUsersStatistics"
  35 + //公司 - 共创用户模式统计
  36 + CooperationUserModeStatistics = "CooperationUserModeStatistics"
  37 + // 公司 - 共创用户分红支付统计
  38 + CompanyPaymentHistoryStatistics = "CompanyPaymentHistoryStatistics"
35 39
36 // 个人 - 共创企业统计 40 // 个人 - 共创企业统计
37 CooperationCompanyStatistics = "CooperationCompanyStatistics" 41 CooperationCompanyStatistics = "CooperationCompanyStatistics"
38 // 个人 - 用户合约统计 42 // 个人 - 用户合约统计
39 PersonCooperationContractStatistics = "PersonCooperationContractStatistics" 43 PersonCooperationContractStatistics = "PersonCooperationContractStatistics"
  44 +
  45 + // 账期结算单统计
  46 + CreditAccountStatistics = "CreditAccountStatistics"
40 ) 47 )
41 48
42 // CooperationStatisticsService 共创统计服务 49 // CooperationStatisticsService 共创统计服务
@@ -302,7 +309,7 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s @@ -302,7 +309,7 @@ func (ptr *CooperationStatisticsService) GetContractDividends(queryOptions map[s
302 return res, nil 309 return res, nil
303 } 310 }
304 311
305 -// 分红统计(分红明细) 312 +// 分红明细
306 func (ptr *CooperationStatisticsService) DividendsStatistics(queryOptions map[string]interface{}) (interface{}, error) { 313 func (ptr *CooperationStatisticsService) DividendsStatistics(queryOptions map[string]interface{}) (interface{}, error) {
307 // 参数验证 314 // 参数验证
308 var request = struct { 315 var request = struct {
@@ -449,3 +456,33 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m @@ -449,3 +456,33 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
449 } 456 }
450 return results, nil 457 return results, nil
451 } 458 }
  459 +
  460 +// 账期结算单统计
  461 +func (ptr *CooperationStatisticsService) CreditAccountStatistics(queryOptions map[string]interface{}) (interface{}, error) {
  462 + // 参数验证
  463 + var request = struct {
  464 + OrgId int64 `json:"orgId"`
  465 + UserBaseId int64 `json:"userBaseId"`
  466 + BeginTime time.Time `json:"beginTime"`
  467 + EndTime time.Time `json:"endTime"`
  468 + }{}
  469 + if err := LoadQueryObject(queryOptions, &request); err != nil {
  470 + return nil, err
  471 + }
  472 + queryOptions = tool_funs.SimpleStructToMap(&request)
  473 +
  474 + type response struct {
  475 + Total float64 `json:"total"`
  476 + Accounting float64 `json:"accounting"`
  477 + Accounted float64 `json:"accounted"`
  478 + Paid float64 `json:"paid"`
  479 + }
  480 + creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
  481 +
  482 + var allDividends = &response{}
  483 + if err := creditAccountDao.DividendsStatistics(queryOptions, allDividends); err != nil {
  484 + return nil, err
  485 + }
  486 + allDividends.Accounting = allDividends.Total - allDividends.Accounted
  487 + return allDividends, nil
  488 +}
@@ -175,6 +175,9 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf @@ -175,6 +175,9 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf
175 if cooperationModeIds, ok := queryOptions["cooperationModeIds"]; ok && len(cooperationModeIds.([]int64)) > 0 { 175 if cooperationModeIds, ok := queryOptions["cooperationModeIds"]; ok && len(cooperationModeIds.([]int64)) > 0 {
176 query.Where("cooperation_mode_id in (?)", pg.In(cooperationModeIds)) 176 query.Where("cooperation_mode_id in (?)", pg.In(cooperationModeIds))
177 } 177 }
  178 + if cooperationModeNumbers, ok := queryOptions["cooperationModeNumbers"]; ok && len(cooperationModeNumbers.([]string)) > 0 {
  179 + query.Where("Cooperation_mode_number in (?)", pg.In(cooperationModeNumbers))
  180 + }
178 if cooperationModeName, ok := queryOptions["cooperationModeName"]; ok && cooperationModeName != "" { 181 if cooperationModeName, ok := queryOptions["cooperationModeName"]; ok && cooperationModeName != "" {
179 query.Where("cooperation_mode_name like ?", fmt.Sprintf("%%%s%%", cooperationModeName)) 182 query.Where("cooperation_mode_name like ?", fmt.Sprintf("%%%s%%", cooperationModeName))
180 } 183 }
@@ -187,7 +190,7 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf @@ -187,7 +190,7 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf
187 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 { 190 if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
188 query.Where("org->>'orgId' = '?'", orgId) 191 query.Where("org->>'orgId' = '?'", orgId)
189 } 192 }
190 - if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 { 193 + if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
191 query.Where("org->>'orgId' in (?)", pg.In(orgIds)) 194 query.Where("org->>'orgId' in (?)", pg.In(orgIds))
192 } 195 }
193 offsetLimitFlag := true 196 offsetLimitFlag := true