From db904d18e27f0a46ff65ee224348bd5fd3fcf7fc Mon Sep 17 00:00:00 2001 From: loshiqi <553578653@qq.com> Date: Wed, 26 Jul 2023 11:35:21 +0800 Subject: [PATCH] =?UTF-8?q?join=E5=85=BC=E5=AE=B9=E5=AD=90=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/db.go b/db.go index c464abb..3622fff 100644 --- a/db.go +++ b/db.go @@ -332,7 +332,9 @@ func GetRow(dbName, table_name, alias string, titles string, join [][]string, wh if len(joinitem) < 2 { continue } - if len(joinitem) == 3 { + if len(joinitem) == 4 { + sql_str = helper.StringJoin(sql_str, " ", joinitem[2], " join ", joinitem[0], " on ", joinitem[1]) + } else if len(joinitem) == 3 { sql_str = helper.StringJoin(sql_str, " ", joinitem[2], " join ", getTableName(dbName, joinitem[0]), " on ", joinitem[1]) } else { //默认左连接 sql_str = helper.StringJoin(sql_str, " left join ", getTableName(dbName, joinitem[0]), " on ", joinitem[1]) @@ -482,7 +484,9 @@ func FetchRows(dbName, table_name, alias string, titles string, join [][]string, if len(joinitem) < 2 { continue } - if len(joinitem) == 3 { + if len(joinitem) == 4 { + sql_str = helper.StringJoin(sql_str, " ", joinitem[2], " join ", joinitem[0], " on ", joinitem[1]) + } else if len(joinitem) == 3 { sql_str = helper.StringJoin(sql_str, " ", joinitem[2], " join ", getTableName(dbName, joinitem[0]), " on ", joinitem[1]) } else { //默认左连接 sql_str = helper.StringJoin(sql_str, " left join ", getTableName(dbName, joinitem[0]), " on ", joinitem[1])