From 22d00739ff3f8dd988c2bb7221be367de54552cb Mon Sep 17 00:00:00 2001 From: hoteas <等> Date: Thu, 5 May 2022 18:33:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0join=E7=9A=84orm=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/hotimedb.go | 8 ++++---- example/app/declare.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/db/hotimedb.go b/db/hotimedb.go index c93eb61..442e36d 100644 --- a/db/hotimedb.go +++ b/db/hotimedb.go @@ -460,15 +460,15 @@ func (that *HoTimeDB) Select(table string, qu ...interface{}) []Map { v := testQuData[k] switch Substr(k, 0, 3) { case "[>]": - query += " LEFT JOIN " + Substr(k, 3, len(k)-3) + " ON " + v.(string) + query += " LEFT JOIN `" + Substr(k, 3, len(k)-3) + "` ON " + v.(string) case "[<]": - query += " RIGHT JOIN " + Substr(k, 3, len(k)-3) + " ON " + v.(string) + query += " RIGHT JOIN `" + Substr(k, 3, len(k)-3) + "` ON " + v.(string) } switch Substr(k, 0, 4) { case "[<>]": - query += " FULL JOIN " + Substr(k, 4, len(k)-4) + " ON " + v.(string) + query += " FULL JOIN `" + Substr(k, 4, len(k)-4) + "` ON " + v.(string) case "[><]": - query += " INNER JOIN " + Substr(k, 4, len(k)-4) + " ON " + v.(string) + query += " INNER JOIN `" + Substr(k, 4, len(k)-4) + "` ON " + v.(string) } } } diff --git a/example/app/declare.go b/example/app/declare.go index d151ee5..2382d5f 100644 --- a/example/app/declare.go +++ b/example/app/declare.go @@ -139,7 +139,7 @@ var DeclareCtr = Ctr{ //标签分析 if tags != nil { for _, v := range tags { - dtag := that.Db.Select("declare_tag", Map{"[><]`declare`": "declare_tag.declare_id=declare.id"}, "declare_tag.declare_id", Map{"AND": Map{"OR": Map{"declare.policy_level": Slice{"省", "市"}, "declare.dispatch_department[~]": qu}, "declare_tag.tag_id": v}}) + dtag := that.Db.Select("declare_tag", Map{"[><]declare": "declare_tag.declare_id=declare.id"}, "declare_tag.declare_id", Map{"AND": Map{"OR": Map{"declare.policy_level": Slice{"省", "市"}, "declare.dispatch_department[~]": qu}, "declare_tag.tag_id": v}}) for _, v1 := range dtag { if declares[v1.GetCeilInt64("declare_id")] == nil { declares[v1.GetCeilInt64("declare_id")] = v1