作者 陈志颖

feat:完善分红预算查询功能

@@ -11,9 +11,9 @@ import ( @@ -11,9 +11,9 @@ import (
11 // SearchDividendsEstimateQuery 查询分红预算单 11 // SearchDividendsEstimateQuery 查询分红预算单
12 type SearchDividendsEstimateQuery struct { 12 type SearchDividendsEstimateQuery struct {
13 // 承接人分红预算单号 13 // 承接人分红预算单号
14 - DividendsEstimateOrderNumber string `cname:"承接人分红预算单号" json:"dividendsEstimateOrderNumber" valid:"Required"` 14 + DividendsEstimateOrderNumber string `cname:"承接人分红预算单号" json:"dividendsEstimateOrderNumber,omitempty"`
15 // 分红类型,1订单分红,2退货冲销,3金额激励 15 // 分红类型,1订单分红,2退货冲销,3金额激励
16 - DividendsType int32 `cname:"分红类型" json:"dividendsType" valid:"Required"` 16 + DividendsType int32 `cname:"分红类型" json:"dividendsType,omitempty"`
17 // 公司ID,通过集成REST上下文获取 17 // 公司ID,通过集成REST上下文获取
18 CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"` 18 CompanyId int64 `cname:"公司ID" json:"companyId,string" valid:"Required"`
19 // 组织机构ID 19 // 组织机构ID
@@ -223,6 +223,12 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte @@ -223,6 +223,12 @@ func (repository *DividendsEstimateRepository) Find(queryOptions map[string]inte
223 var dividendsEstimateModels []*models.DividendsEstimate 223 var dividendsEstimateModels []*models.DividendsEstimate
224 dividendsEstimates := make([]*domain.DividendsEstimate, 0) 224 dividendsEstimates := make([]*domain.DividendsEstimate, 0)
225 query := sqlbuilder.BuildQuery(tx.Model(&dividendsEstimateModels), queryOptions) 225 query := sqlbuilder.BuildQuery(tx.Model(&dividendsEstimateModels), queryOptions)
  226 + if dividendsType, ok := queryOptions["dividendsType"]; ok && dividendsType.(int32) != 0 {
  227 + query.Where("dividends_type = ?", dividendsType)
  228 + }
  229 + if dividendsEstimateOrderNumber, ok := queryOptions["dividendsEstimateOrderNumber"]; ok && dividendsEstimateOrderNumber != "" {
  230 + query.Where("dividends_estimate_order_number ilike ?", fmt.Sprintf("%%%s%%", dividendsEstimateOrderNumber))
  231 + }
226 offsetLimitFlag := true 232 offsetLimitFlag := true
227 if offsetLimit, ok := queryOptions["offsetLimit"]; ok { 233 if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
228 offsetLimitFlag = offsetLimit.(bool) 234 offsetLimitFlag = offsetLimit.(bool)