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