fix(tenement):修正商户中带有JSONB字段的插入语句。

This commit is contained in:
徐涛 2023-06-27 15:05:04 +08:00
parent a1a72b7204
commit 0c389e440a

View File

@ -197,15 +197,10 @@ func (tr _TenementRepository) AddTenement(tx pgx.Tx, ctx context.Context, pid st
serial.StringSerialRequestChan <- 1
tenementId := serial.Prefix("T", <-serial.StringSerialResponseChan)
currentTime := types.Now()
createSql, createArgs, _ := tr.ds.
Insert("tenement").
Cols(
"id", "park_id", "full_name", "short_name", "abbr", "address", "contact_name", "contact_phone",
"building", "on_floor", "invoice_info",
"moved_in_at", "created_at", "last_modified_at",
).
Vals(
goqu.Vals{
if _, err := tx.Exec(
ctx,
"INSERT INTO tenement (id, park_id, full_name, short_name, abbr, address, contact_name, contact_phone, building, on_floor, invoice_info, moved_in_at, created_at, last_modified_at) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14)",
[]interface{}{
tenementId,
pid,
tenement.Name,
@ -227,10 +222,8 @@ func (tr _TenementRepository) AddTenement(tx pgx.Tx, ctx context.Context, pid st
currentTime,
currentTime,
currentTime,
},
).
Prepared(true).ToSQL()
if _, err := tx.Exec(ctx, createSql, createArgs...); err != nil {
}...,
); err != nil {
tr.log.Error("在指定园区中创建一个新的商户失败", zap.Error(err))
return err
}