update input param
This commit is contained in:
@ -14,6 +14,7 @@ import (
|
||||
"git.zhangdeman.cn/zhangdeman/database/abstract"
|
||||
"git.zhangdeman.cn/zhangdeman/database/define"
|
||||
"git.zhangdeman.cn/zhangdeman/wrapper"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -39,6 +40,9 @@ func (e *execute) SetDatabaseClientManager(databaseClientManager abstract.IWrapp
|
||||
//
|
||||
// Date : 20:48 2024/8/21
|
||||
func (e *execute) Run(ctx context.Context, inputParam *define.Api2SqlParam) (any, error) {
|
||||
if err := e.formatAndValidateInputParam(inputParam); nil != err {
|
||||
return nil, err
|
||||
}
|
||||
if len(inputParam.InputSql) > 0 {
|
||||
// 基于表达式执行
|
||||
return e.Express(ctx, inputParam)
|
||||
@ -68,6 +72,17 @@ func (e *execute) Run(ctx context.Context, inputParam *define.Api2SqlParam) (any
|
||||
//
|
||||
// Date : 20:52 2024/8/21
|
||||
func (e *execute) List(ctx context.Context, inputParam *define.Api2SqlParam) (any, error) {
|
||||
replaceTable := map[string]string{
|
||||
"{FIELD_LIST}": "`" + strings.Join(inputParam.ColumnList, "` , `"),
|
||||
"{TABLE}": inputParam.Table,
|
||||
}
|
||||
sqlTplList := []string{
|
||||
define.SqlSelectBaseTpl,
|
||||
}
|
||||
if len(inputParam.ValueList) > 0 {
|
||||
// where 条件
|
||||
sqlTplList = append(sqlTplList, define.SqlWhereTpl)
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user