...
|
...
|
@@ -17,16 +17,16 @@ func (repository *SuMoneyTransactionRecordRepository) Save(suMoneyTransactionRec |
|
|
tx := repository.transactionContext.PgTx
|
|
|
if suMoneyTransactionRecord.Identify() == nil {
|
|
|
if _, err := tx.QueryOne(
|
|
|
pg.Scan(&suMoneyTransactionRecord.SuMoneyTransactionRecordId, &suMoneyTransactionRecord.RecordType, &suMoneyTransactionRecord.Employee, &suMoneyTransactionRecord.SuMoney, &suMoneyTransactionRecord.Operator, &suMoneyTransactionRecord.RecordDescription, &suMoneyTransactionRecord.CreateTime),
|
|
|
"INSERT INTO su_money_transaction_records (record_type, employee, su_money, operator, record_description, create_time) VALUES (?, ?, ?, ?, ?, ?) RETURNING id, record_type, employee, su_money, operator, record_description, create_time",
|
|
|
suMoneyTransactionRecord.RecordType, suMoneyTransactionRecord.Employee, suMoneyTransactionRecord.SuMoney, suMoneyTransactionRecord.Operator, suMoneyTransactionRecord.RecordDescription, suMoneyTransactionRecord.CreateTime); err != nil {
|
|
|
pg.Scan(&suMoneyTransactionRecord.SuMoneyTransactionRecordId, &suMoneyTransactionRecord.RecordType, &suMoneyTransactionRecord.Employee, &suMoneyTransactionRecord.SuMoneyBeforeTransaction, &suMoneyTransactionRecord.SuMoney, &suMoneyTransactionRecord.Operator, &suMoneyTransactionRecord.RecordDescription, &suMoneyTransactionRecord.CreateTime),
|
|
|
"INSERT INTO su_money_transaction_records (record_type, employee, su_money_before_transaction, su_money, operator, record_description, create_time) VALUES (?, ?, ?, ?, ?, ?, ?) RETURNING id, record_type, employee, su_money_before_transaction, su_money, operator, record_description, create_time",
|
|
|
suMoneyTransactionRecord.RecordType, suMoneyTransactionRecord.Employee, suMoneyTransactionRecord.SuMoneyBeforeTransaction, suMoneyTransactionRecord.SuMoney, suMoneyTransactionRecord.Operator, suMoneyTransactionRecord.RecordDescription, suMoneyTransactionRecord.CreateTime); err != nil {
|
|
|
return suMoneyTransactionRecord, err
|
|
|
}
|
|
|
} else {
|
|
|
if _, err := tx.QueryOne(
|
|
|
pg.Scan(&suMoneyTransactionRecord.SuMoneyTransactionRecordId, &suMoneyTransactionRecord.RecordType, &suMoneyTransactionRecord.Employee, &suMoneyTransactionRecord.SuMoney, &suMoneyTransactionRecord.Operator, &suMoneyTransactionRecord.RecordDescription, &suMoneyTransactionRecord.CreateTime),
|
|
|
"UPDATE su_money_transaction_records SET record_type=?, employee=?, su_money=?, operator=?, record_description=?, create_time=? WHERE id=? RETURNING id, record_type, employee, su_money, operator, record_description, create_time",
|
|
|
suMoneyTransactionRecord.RecordType, suMoneyTransactionRecord.Employee, suMoneyTransactionRecord.SuMoney, suMoneyTransactionRecord.Operator, suMoneyTransactionRecord.RecordDescription, suMoneyTransactionRecord.CreateTime, suMoneyTransactionRecord.SuMoneyTransactionRecordId); err != nil {
|
|
|
pg.Scan(&suMoneyTransactionRecord.SuMoneyTransactionRecordId, &suMoneyTransactionRecord.RecordType, &suMoneyTransactionRecord.Employee, &suMoneyTransactionRecord.SuMoneyBeforeTransaction, &suMoneyTransactionRecord.SuMoney, &suMoneyTransactionRecord.Operator, &suMoneyTransactionRecord.RecordDescription, &suMoneyTransactionRecord.CreateTime),
|
|
|
"UPDATE su_money_transaction_records SET record_type=?, employee=?, su_money_before_transaction=?, su_money=?, operator=?, record_description=?, create_time=? WHERE id=? RETURNING id, record_type, employee, su_money, operator, record_description, create_time",
|
|
|
suMoneyTransactionRecord.RecordType, suMoneyTransactionRecord.Employee, suMoneyTransactionRecord.SuMoneyBeforeTransaction, suMoneyTransactionRecord.SuMoney, suMoneyTransactionRecord.Operator, suMoneyTransactionRecord.RecordDescription, suMoneyTransactionRecord.CreateTime, suMoneyTransactionRecord.SuMoneyTransactionRecordId); err != nil {
|
|
|
return suMoneyTransactionRecord, err
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -110,6 +110,7 @@ func (repository *SuMoneyTransactionRecordRepository) transformPgModelToDomainMo |
|
|
SuMoneyTransactionRecordId: suMoneyTransactionRecordModel.Id,
|
|
|
RecordType: suMoneyTransactionRecordModel.RecordType,
|
|
|
Employee: suMoneyTransactionRecordModel.Employee,
|
|
|
SuMoneyBeforeTransaction: suMoneyTransactionRecordModel.SuMoneyBeforeTransaction,
|
|
|
SuMoney: suMoneyTransactionRecordModel.SuMoney,
|
|
|
Operator: suMoneyTransactionRecordModel.Operator,
|
|
|
RecordDescription: suMoneyTransactionRecordModel.RecordDescription,
|
...
|
...
|
|