money_incentives_rule.go
1.7 KB
package transform
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/utils"
)
func TransformToMoneyIncentivesRuleDomainModelFromPgModels(moneyIncentivesRuleModel *models.MoneyIncentivesRule) (*domain.MoneyIncentivesRule, error) {
stageString := utils.NumberToCNNumber(int(moneyIncentivesRuleModel.MoneyIncentivesStage))
return &domain.MoneyIncentivesRule{
MoneyIncentivesRuleId: moneyIncentivesRuleModel.MoneyIncentivesRuleId,
CooperationContractNumber: moneyIncentivesRuleModel.CooperationContractNumber,
MoneyIncentivesAmount: moneyIncentivesRuleModel.MoneyIncentivesAmount,
MoneyIncentivesStage: moneyIncentivesRuleModel.MoneyIncentivesStage,
MoneyIncentivesStageCN: stageString,
MoneyIncentivesStageEnd: moneyIncentivesRuleModel.MoneyIncentivesStageEnd,
MoneyIncentivesStageStart: moneyIncentivesRuleModel.MoneyIncentivesStageStart,
MoneyIncentivesTime: moneyIncentivesRuleModel.MoneyIncentivesTime,
ReferrerPercentage: moneyIncentivesRuleModel.ReferrerPercentage,
SalesmanPercentage: moneyIncentivesRuleModel.SalesmanPercentage,
Remarks: moneyIncentivesRuleModel.Remarks,
Org: moneyIncentivesRuleModel.Org,
Company: moneyIncentivesRuleModel.Company,
UpdatedAt: moneyIncentivesRuleModel.UpdatedAt,
DeletedAt: moneyIncentivesRuleModel.DeletedAt,
CreatedAt: moneyIncentivesRuleModel.CreatedAt,
}, nil
}