作者 陈志颖

fix:关联组织机构查询

正在显示 31 个修改的文件 包含 104 行增加56 行删除
... ... @@ -14,7 +14,7 @@ type SearchContractUndertakerFeedbackQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -26,7 +26,7 @@ type SearchCooperationApplicationQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -22,7 +22,7 @@ type SearchCooperationContractQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -18,7 +18,7 @@ type SearchCooperationContractByUndertakerQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -22,7 +22,7 @@ type SearchCooperationContractChangeLogQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -24,7 +24,7 @@ type SearchCooperationModeQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -26,7 +26,7 @@ type SearchCooperationProjectQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -27,7 +27,7 @@ type SearchCreditAccountQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -19,7 +19,7 @@ type SearchDividendsEstimateQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -19,7 +19,7 @@ type SearchDividendsIncentivesEstimateQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -19,7 +19,7 @@ type SearchMoneyIncentivesEstimateQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -22,7 +22,7 @@ type SearchDividendsOrderQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ... @@ -30,7 +30,6 @@ type SearchDividendsOrderQuery struct {
}
func (searchDividendsOrderQuery *SearchDividendsOrderQuery) Valid(validation *validation.Validation) {
//validation.SetError("CustomValid", "未实现的自定义认证")
}
func (searchDividendsOrderQuery *SearchDividendsOrderQuery) ValidateQuery() error {
... ...
... ... @@ -16,7 +16,7 @@ type SearchDividendsOrderNumberQuery struct {
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
... ...
... ... @@ -278,7 +278,18 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
}
// 返回信息表头定义
var tableHeader = []string{"错误详情", "行号", "来源单号", "客户名称", "产品名称", "订单日期", "订单区域", "产品数量", "产品价格", "费用", "项目合约编号"}
var tableHeader = map[string]interface{}{
"failReason": "错误详情",
"originalOrderNum": "来源单号",
"dividendsCustomerName": "客户名称",
"orderGoodName": "产品名称",
"orderTime": "订单日期",
"regionName": "订单区域",
"orderGoodQuantity": "产品数量",
"orderGoodPrice": "产品价格",
"expense": "费用",
"cooperationContractNumber": "项目合约编号",
}
// 空文件校验
if len(importDividendsOrderCommand.DividendsOrderData) == 0 {
... ... @@ -326,8 +337,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
return map[string]interface{}{
"successCount": 0,
"fail": map[string]interface{}{
"tableHeader": tableHeader,
"tableData": nullCellError,
"header": tableHeader,
"body": nullCellError,
},
}, nil
}
... ... @@ -431,8 +442,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
return map[string]interface{}{
"successCount": 0,
"fail": map[string]interface{}{
"tableHeader": tableHeader,
"tableData": typeError,
"header": tableHeader,
"body": typeError,
},
}, nil
}
... ... @@ -539,8 +550,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
return map[string]interface{}{
"successCount": 0,
"fail": map[string]interface{}{
"tableHeader": tableHeader,
"tableData": aggregateErrorList,
"header": tableHeader,
"body": aggregateErrorList,
},
}, nil
}
... ... @@ -602,8 +613,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
return map[string]interface{}{
"successCount": successDataCount,
"fail": map[string]interface{}{
"tableHeader": tableHeader,
"tableData": failureDataList,
"header": tableHeader,
"body": failureDataList,
},
}, nil
}
... ... @@ -733,8 +744,8 @@ func (dividendsOrderService *DividendsOrderService) ImportDividendsOrder(importD
return map[string]interface{}{
"successCount": successDataCount,
"fail": map[string]interface{}{
"tableHeader": tableHeader,
"tableData": failureDataList,
"header": tableHeader,
"body": failureDataList,
},
}, nil
}
... ...
... ... @@ -20,7 +20,7 @@ type SearchDividendsReturnedOrderQuery struct {
// 公司ID,通过集成REST上下文获取
CompanyId int64 `cname:"公司ID" json:"companyId"`
// 关联的组织机构ID列表
OrgIds []string `cname:"关联的组织机构ID列表" json:"orgIds"`
OrgIds []int64 `cname:"关联的组织机构ID列表" json:"orgIds"`
// 组织机构ID
OrgId int64 `cname:"组织机构ID" json:"orgId"`
// 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
... ...
... ... @@ -10,6 +10,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/transform"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
)
type ContractUndertakerFeedbackRepository struct {
... ... @@ -162,8 +163,9 @@ func (repository *ContractUndertakerFeedbackRepository) Find(queryOptions map[st
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
// 搜索内容包括项目合约名称、承接人姓名、承接内容关键字
if matchWord, ok := queryOptions["matchWord"]; ok && matchWord != "" {
... ...
... ... @@ -3,6 +3,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"time"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
... ... @@ -243,8 +244,9 @@ func (repository *CooperationApplicationRepository) Find(queryOptions map[string
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
... ...
... ... @@ -3,6 +3,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
... ... @@ -171,8 +172,9 @@ func (repository *CooperationContractChangeLogRepository) Find(queryOptions map[
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
if offsetLimitFlag {
query.SetOffsetAndLimit(20)
... ...
... ... @@ -3,6 +3,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
... ... @@ -176,8 +177,9 @@ func (repository *CooperationContractRelevantRepository) Find(queryOptions map[s
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
query.Where("user_base_id = ?", userBaseId)
... ...
... ... @@ -995,8 +995,9 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
if incentivesType, ok := queryOptions["incentivesType"]; ok && incentivesType.(int32) != 0 {
query.Where("incentives_type = ?", incentivesType)
... ...
... ... @@ -3,6 +3,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
... ... @@ -187,8 +188,9 @@ func (repository *CooperationContractUndertakerRepository) Find(queryOptions map
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
query.Where("user_base_id = ? ", userBaseId)
... ...
... ... @@ -9,6 +9,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/transform"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
)
type CooperationModeRepository struct {
... ... @@ -190,8 +191,9 @@ func (repository *CooperationModeRepository) Find(queryOptions map[string]interf
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
... ...
... ... @@ -3,6 +3,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"time"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
... ... @@ -252,8 +253,9 @@ func (repository *CooperationProjectRepository) Find(queryOptions map[string]int
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
if v, ok := queryOptions["status"]; ok && v.(int32) > 0 {
query.Where("status =? ", v)
... ...
... ... @@ -3,6 +3,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
... ... @@ -218,8 +219,9 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
... ...
... ... @@ -3,6 +3,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"time"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
... ... @@ -301,8 +302,9 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
... ...
... ... @@ -3,6 +3,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
... ... @@ -171,8 +172,9 @@ func (repository *DividendsIncentivesRuleRepository) Find(queryOptions map[strin
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
... ...
... ... @@ -413,8 +413,9 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
... ...
... ... @@ -415,8 +415,9 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
... ...
... ... @@ -3,6 +3,7 @@ package repository
import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
... ... @@ -171,8 +172,9 @@ func (repository *MoneyIncentivesRuleRepository) Find(queryOptions map[string]in
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org->>'orgId' = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org->>'orgId' in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
... ...
... ... @@ -4,6 +4,7 @@ import (
"fmt"
"github.com/go-pg/pg/v10"
"github.com/go-pg/pg/v10/orm"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
... ... @@ -184,8 +185,9 @@ func (repository *OrderGoodRepository) Find(queryOptions map[string]interface{})
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
query.Where("org_id = '?'", orgId)
}
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]string)) > 0 {
query.Where("org_id in (?)", pg.In(orgIds))
if orgIds, ok := queryOptions["orgIds"]; ok && len(orgIds.([]int64)) > 0 {
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org_id in (?)", pg.In(newOrgIds))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
... ...
... ... @@ -45,6 +45,7 @@ func Difference(slice1, slice2 []int64) []int64 {
return nn
}
// SliceAtoi 字符创数组转数字数组
func SliceAtoi(sa []string) ([]int64, error) {
si := make([]int64, 0, len(sa))
for _, a := range sa {
... ... @@ -57,6 +58,16 @@ func SliceAtoi(sa []string) ([]int64, error) {
return si, nil
}
// SliceItoa 数字数组转字符创数组
func SliceItoa(sa []int64) []string {
si := make([]string, 0, len(sa))
for _, a := range sa {
s := strconv.Itoa(int(a))
si = append(si, s)
}
return si
}
func Round(value float64, places int32) float64 {
quantity := decimal.NewFromFloat(value)
d := quantity.Round(places)
... ...