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])