|
@@ -18,9 +18,9 @@ func (repository *ExchangeCashActivityRepository) Save(exchangeCashActivity *dom |
|
@@ -18,9 +18,9 @@ func (repository *ExchangeCashActivityRepository) Save(exchangeCashActivity *dom |
18
|
tx := repository.transactionContext.PgTx
|
18
|
tx := repository.transactionContext.PgTx
|
19
|
if exchangeCashActivity.Identity() == nil {
|
19
|
if exchangeCashActivity.Identity() == nil {
|
20
|
if _, err := tx.QueryOne(
|
20
|
if _, err := tx.QueryOne(
|
21
|
- pg.Scan(&exchangeCashActivity.ActivityId, &exchangeCashActivity.CompanyId, &exchangeCashActivity.ExchangeActivityName, &exchangeCashActivity.Deadline, &exchangeCashActivity.CountDown, &exchangeCashActivity.ExchangedCash, &exchangeCashActivity.ExchangedSuMoney, &exchangeCashActivity.Rate),
|
|
|
22
|
- "INSERT INTO exchange_cash_activities ( company_id, activity_name, deadline, count_down, exchanged_cash, exchanged_su_money, exchange_rate) VALUES (?, ?, ?, ?, ?, ?, ? ) RETURNING id, company_id, activity_name, deadline, count_down, exchanged_cash, exchanged_su_money, exchange_rate" ,
|
|
|
23
|
- exchangeCashActivity.CompanyId, exchangeCashActivity.ExchangeActivityName, exchangeCashActivity.Deadline, exchangeCashActivity.CountDown, exchangeCashActivity.ExchangedCash, exchangeCashActivity.ExchangedSuMoney, exchangeCashActivity.Rate); err != nil {
|
21
|
+ pg.Scan(&exchangeCashActivity.ActivityId, &exchangeCashActivity.CompanyId, &exchangeCashActivity.ExchangeActivityName, &exchangeCashActivity.Deadline, &exchangeCashActivity.CountDown, &exchangeCashActivity.ExchangedCash, &exchangeCashActivity.ExchangedSuMoney, &exchangeCashActivity.Rate, &exchangeCashActivity.CreateTime),
|
|
|
22
|
+ "INSERT INTO exchange_cash_activities ( company_id, activity_name, deadline, count_down, exchanged_cash, exchanged_su_money, exchange_rate, create_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?) RETURNING id, company_id, activity_name, deadline, count_down, exchanged_cash, exchanged_su_money, exchange_rate, create_time" ,
|
|
|
23
|
+ exchangeCashActivity.CompanyId, exchangeCashActivity.ExchangeActivityName, exchangeCashActivity.Deadline, exchangeCashActivity.CountDown, exchangeCashActivity.ExchangedCash, exchangeCashActivity.ExchangedSuMoney, exchangeCashActivity.Rate, &exchangeCashActivity.CreateTime); err != nil {
|
24
|
return exchangeCashActivity, err
|
24
|
return exchangeCashActivity, err
|
25
|
}
|
25
|
}
|
26
|
} else {
|
26
|
} else {
|
|
@@ -38,7 +38,7 @@ func (repository *ExchangeCashActivityRepository) FindOne(queryOptions map[strin |
|
@@ -38,7 +38,7 @@ func (repository *ExchangeCashActivityRepository) FindOne(queryOptions map[strin |
38
|
tx := repository.transactionContext.PgTx
|
38
|
tx := repository.transactionContext.PgTx
|
39
|
exchangeCashActivityModel := new(models.ExchangeCashActivity)
|
39
|
exchangeCashActivityModel := new(models.ExchangeCashActivity)
|
40
|
query := tx.Model(exchangeCashActivityModel)
|
40
|
query := tx.Model(exchangeCashActivityModel)
|
41
|
- if exchangeCashActivityId, ok := queryOptions["exchangeCashActivityId"]; ok {
|
41
|
+ if exchangeCashActivityId, ok := queryOptions["activityId"]; ok {
|
42
|
query = query.Where("exchange_cash_activity.id = ?", exchangeCashActivityId)
|
42
|
query = query.Where("exchange_cash_activity.id = ?", exchangeCashActivityId)
|
43
|
}
|
43
|
}
|
44
|
if err := query.First(); err != nil {
|
44
|
if err := query.First(); err != nil {
|