From 1b87f5e30d49d19578ec34acccb32c9d3a44bafd Mon Sep 17 00:00:00 2001 From: anqiansong Date: Fri, 14 Oct 2022 12:27:04 +0800 Subject: [PATCH] Fix mongo insert tpl (#2512) --- tools/goctl/model/mongo/template/model.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/goctl/model/mongo/template/model.tpl b/tools/goctl/model/mongo/template/model.tpl index c88f1462..c07d7896 100644 --- a/tools/goctl/model/mongo/template/model.tpl +++ b/tools/goctl/model/mongo/template/model.tpl @@ -29,7 +29,7 @@ func newDefault{{.Type}}Model(conn {{if .Cache}}*monc.Model{{else}}*mon.Model{{e func (m *default{{.Type}}Model) Insert(ctx context.Context, data *{{.Type}}) error { - if !data.ID.IsZero() { + if data.ID.IsZero() { data.ID = primitive.NewObjectID() data.CreateAt = time.Now() data.UpdateAt = time.Now()