Skip to content

Commit

Permalink
fix🐛: 更新数据为主键赋值nil
Browse files Browse the repository at this point in the history
  • Loading branch information
abulo committed Jul 11, 2024
1 parent fae2abc commit 1866be1
Show file tree
Hide file tree
Showing 23 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions cloud/api/pay/app/pay_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ func PayAppUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
1 change: 1 addition & 0 deletions cloud/api/pay/notify/pay_notify_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func PayNotifyTaskUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
1 change: 1 addition & 0 deletions cloud/api/pay/order/pay_order.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func PayOrderUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
1 change: 1 addition & 0 deletions cloud/api/pay/refund/pay_refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func PayRefundUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
1 change: 1 addition & 0 deletions cloud/api/pay/wallet/pay_wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ func PayWalletUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
1 change: 1 addition & 0 deletions cloud/api/pay/wallet/pay_wallet_recharge_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func PayWalletRechargePackageUpdate(ctx context.Context, newCtx *app.RequestCont
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
9 changes: 9 additions & 0 deletions cloud/api/region/region.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
"cloud/service/region"

globalLogger "github.com/abulo/ratel/v3/core/logger"
"github.com/abulo/ratel/v3/stores/null"
"github.com/abulo/ratel/v3/util"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/common/utils"
"github.com/cloudwego/hertz/pkg/protocol/consts"
Expand Down Expand Up @@ -46,6 +48,8 @@ func RegionCreate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Creator = null.StringFrom(newCtx.GetString("userName"))
reqInfo.CreateTime = null.DateTimeFrom(util.Now())
request.Data = region.RegionProto(reqInfo)
// 执行服务
res, err := client.RegionCreate(ctx, request)
Expand Down Expand Up @@ -95,6 +99,11 @@ func RegionUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
reqInfo.Creator = null.StringFromPtr(nil)
reqInfo.CreateTime = null.DateTimeFromPtr(nil)
request.Data = region.RegionProto(reqInfo)
// 执行服务
res, err := client.RegionUpdate(ctx, request)
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/dept/system_dept.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func SystemDeptCreate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.Deleted = proto.Int32(0)
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Creator = null.StringFrom(newCtx.GetString("userName"))
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/dict/system_dict.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func SystemDictUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
reqInfo.Creator = null.StringFromPtr(nil)
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/dict/system_dict_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func SystemDictTypeUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
reqInfo.Creator = null.StringFromPtr(nil)
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/file/system_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ func SystemFileUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/mail/system_mail_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func SystemMailAccountUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
reqInfo.Creator = null.StringFromPtr(nil)
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/mail/system_mail_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func SystemMailLogUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
reqInfo.Creator = null.StringFromPtr(nil)
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/mail/system_mail_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func SystemMailTemplateUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
reqInfo.Creator = null.StringFromPtr(nil)
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/menu/system_menu.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ func SystemMenuUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
request.Data = menu.SystemMenuProto(reqInfo)
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/notice/system_notice.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func SystemNoticeUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/notify/system_notify_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ func SystemNotifyMessageUpdate(ctx context.Context, newCtx *app.RequestContext)
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/notify/system_notify_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func SystemNotifyTemplateUpdate(ctx context.Context, newCtx *app.RequestContext)
})
return
}
reqInfo.Id = nil
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
reqInfo.Creator = null.StringFromPtr(nil)
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/post/system_post.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func SystemPostUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/role/system_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ func SystemRoleUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/tenant/system_tenant.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ func SystemTenantUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
request.Data = tenant.SystemTenantProto(reqInfo)
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/tenant/system_tenant_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ func SystemTenantPackageUpdate(ctx context.Context, newCtx *app.RequestContext)
})
return
}
reqInfo.Id = nil
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
request.Data = tenant.SystemTenantPackageProto(reqInfo)
Expand Down
1 change: 1 addition & 0 deletions cloud/api/system/user/system_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func SystemUserUpdate(ctx context.Context, newCtx *app.RequestContext) {
})
return
}
reqInfo.Id = nil
reqInfo.TenantId = proto.Int64(newCtx.GetInt64("tenantId")) // 租户
reqInfo.Updater = null.StringFrom(newCtx.GetString("userName"))
reqInfo.UpdateTime = null.DateTimeFrom(util.Now())
Expand Down

0 comments on commit 1866be1

Please sign in to comment.