作者 陈志颖

fix:根据分红单ID查找分红单详情

@@ -10,7 +10,7 @@ import ( @@ -10,7 +10,7 @@ import (
10 10
11 type GetDividendsOrderQuery struct { 11 type GetDividendsOrderQuery struct {
12 // 分红订单ID 12 // 分红订单ID
13 - DividendsOrderId int64 `cname:"分红订单ID" json:"dividendsOrderId" valid:"Required"` 13 + DividendsOrderId int64 `cname:"分红订单ID" json:"dividendsOrderId,omitempty"`
14 // 分红订单编号 14 // 分红订单编号
15 DividendsOrderNumber string `cname:"分红订单编号" json:"dividendsOrderNumber,omitempty"` 15 DividendsOrderNumber string `cname:"分红订单编号" json:"dividendsOrderNumber,omitempty"`
16 // 公司ID,通过集成REST上下文获取 16 // 公司ID,通过集成REST上下文获取
@@ -20,7 +20,7 @@ type GetDividendsOrderQuery struct { @@ -20,7 +20,7 @@ type GetDividendsOrderQuery struct {
20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员 20 // 用户ID,通过集成REST上下文获取,可翻译成发起人、承接人、推荐人、业务员
21 UserId int64 `cname:"用户ID" json:"userId" valid:"Required"` 21 UserId int64 `cname:"用户ID" json:"userId" valid:"Required"`
22 // 用户基础数据id 22 // 用户基础数据id
23 - UserBaseId int64 `canme:"用户基础数据ID" json:"userBaseId" valid:"Required"` 23 + UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId" valid:"Required"`
24 } 24 }
25 25
26 func (getDividendsOrderQuery *GetDividendsOrderQuery) Valid(validation *validation.Validation) { 26 func (getDividendsOrderQuery *GetDividendsOrderQuery) Valid(validation *validation.Validation) {
@@ -447,7 +447,10 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte @@ -447,7 +447,10 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte
447 tx := repository.transactionContext.PgTx 447 tx := repository.transactionContext.PgTx
448 dividendsOrderModel := new(models.DividendsOrder) 448 dividendsOrderModel := new(models.DividendsOrder)
449 query := sqlbuilder.BuildQuery(tx.Model(dividendsOrderModel), queryOptions) 449 query := sqlbuilder.BuildQuery(tx.Model(dividendsOrderModel), queryOptions)
450 - query.SetWhereByQueryOption("dividends_order.dividends_order_id = ?", "dividendsOrderId") 450 + //query.SetWhereByQueryOption("dividends_order.dividends_order_id = ?", "dividendsOrderId")
  451 + if dividendsOrderId, ok := queryOptions["dividendsOrderId"]; ok && dividendsOrderId.(int64) != 0 {
  452 + query.Where("dividends_order.dividends_order_id = ?", dividendsOrderId)
  453 + }
451 if dividendsOrderNumber, ok := queryOptions["dividendsOrderNumber"]; ok && dividendsOrderNumber != "" { 454 if dividendsOrderNumber, ok := queryOptions["dividendsOrderNumber"]; ok && dividendsOrderNumber != "" {
452 query.Where("dividends_order.dividends_order_number = ?", dividendsOrderNumber) 455 query.Where("dividends_order.dividends_order_number = ?", dividendsOrderNumber)
453 } 456 }