From f90aec27a3531e766e96ed6151ea22e293c62694 Mon Sep 17 00:00:00 2001 From: zhenghaorong Date: Thu, 25 Aug 2022 09:47:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=90=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chain.go | 8 ++++++-- transaction_chain.go | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/chain.go b/chain.go index 4c2e37f..6c1bf7a 100644 --- a/chain.go +++ b/chain.go @@ -159,8 +159,12 @@ func (this *Query) BuildSelectSql() (map[string]interface{}, error) { if this.dbname == "" && this.table == "" { return nil, errors.New("参数错误,没有数据表") } - - table := getTableName(this.dbname, this.table, this.dbtype) + var table = "" + if strings.Contains(this.table, "select ") { + table = this.table + } else { + table = getTableName(this.dbname, this.table, this.dbtype) + } // var err error diff --git a/transaction_chain.go b/transaction_chain.go index dfa90bc..5266d2f 100644 --- a/transaction_chain.go +++ b/transaction_chain.go @@ -160,8 +160,12 @@ func (this *TxQuery) BuildSelectSql() (map[string]interface{}, error) { if this.dbname == "" && this.table == "" { return nil, errors.New("参数错误,没有数据表") } - - table := getTableName(this.dbname, this.table) + var table = "" + if strings.Contains(this.table, "select ") { + table = this.table + } else { + table = getTableName(this.dbname, this.table) + } var sql, title string