作者 陈志颖

feat:分红预算增加查询方法

@@ -392,6 +392,7 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsEstimate( @@ -392,6 +392,7 @@ func (dividendsEstimateService *DividendsEstimateService) ListDividendsEstimate(
392 defer func() { 392 defer func() {
393 _ = transactionContext.RollbackTransaction() 393 _ = transactionContext.RollbackTransaction()
394 }() 394 }()
  395 + // 分红预算仓储初始化
395 var dividendsEstimateRepository domain.DividendsEstimateRepository 396 var dividendsEstimateRepository domain.DividendsEstimateRepository
396 if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{ 397 if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{
397 "transactionContext": transactionContext, 398 "transactionContext": transactionContext,
@@ -470,10 +471,28 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat @@ -470,10 +471,28 @@ func (dividendsEstimateService *DividendsEstimateService) SearchDividendsEstimat
470 defer func() { 471 defer func() {
471 _ = transactionContext.RollbackTransaction() 472 _ = transactionContext.RollbackTransaction()
472 }() 473 }()
  474 + // 分红预算仓储初始化
  475 + var dividendsEstimateRepository domain.DividendsEstimateRepository
  476 + if value, err := factory.CreateDividendsEstimateRepository(map[string]interface{}{
  477 + "transactionContext": transactionContext,
  478 + }); err != nil {
  479 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  480 + } else {
  481 + dividendsEstimateRepository = value
  482 + }
  483 + if count, dividendsEstimates, err := dividendsEstimateRepository.Find(tool_funs.SimpleStructToMap(searchDividendsEstimateQuery)); err != nil {
  484 + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error())
  485 + } else {
473 if err := transactionContext.CommitTransaction(); err != nil { 486 if err := transactionContext.CommitTransaction(); err != nil {
474 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) 487 return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
475 } 488 }
476 - return nil, nil 489 + return map[string]interface{}{
  490 + "grid": map[string]interface{}{
  491 + "total": count,
  492 + "list": dividendsEstimates,
  493 + },
  494 + }, nil
  495 + }
477 } 496 }
478 497
479 // SearchDividendsIncentivesEstimate 查询业绩激励分红预算 498 // SearchDividendsIncentivesEstimate 查询业绩激励分红预算