|
|
@@ -527,7 +527,11 @@ func CheckHasOnlyOne(executor Executor, executeParams *sql.CheckHasOnlyOneExecut
|
|
|
return int64(tableRows[0]["count"].(float64)) == 1, nil
|
|
|
}
|
|
|
|
|
|
-func ExecuteRawSql(executor Executor, sql string, executeParams map[string]any, args ...any) ([]sql.Result, error) {
|
|
|
+func ExecuteRawSql(executor Executor, sql string, args ...any) ([]sql.Result, error) {
|
|
|
+ return ExecuteRawSqlTemplate(executor, sql, nil, args...)
|
|
|
+}
|
|
|
+
|
|
|
+func ExecuteRawSqlTemplate(executor Executor, sql string, executeParams map[string]any, args ...any) ([]sql.Result, error) {
|
|
|
if executor == nil {
|
|
|
return nil, errors.New("没有传递执行器")
|
|
|
}
|
|
|
@@ -543,37 +547,3 @@ func ExecuteRawSql(executor Executor, sql string, executeParams map[string]any,
|
|
|
|
|
|
return tableRows, nil
|
|
|
}
|
|
|
-
|
|
|
-func ExecuteSql(executor Executor, name string, args ...any) ([]sql.Result, error) {
|
|
|
- if executor == nil {
|
|
|
- return nil, errors.New("没有传递执行器")
|
|
|
- }
|
|
|
-
|
|
|
- if strutils.IsStringEmpty(name) {
|
|
|
- return nil, errors.New("没有sql资源名称")
|
|
|
- }
|
|
|
-
|
|
|
- tableRows, err := executor.ExecuteRawSql(name, args...)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
-
|
|
|
- return tableRows, nil
|
|
|
-}
|
|
|
-
|
|
|
-func ExecuteSqlTemplate(executor Executor, name string, executeParams map[string]any, args ...any) ([]sql.Result, error) {
|
|
|
- if executor == nil {
|
|
|
- return nil, errors.New("没有传递执行器")
|
|
|
- }
|
|
|
-
|
|
|
- if strutils.IsStringEmpty(name) {
|
|
|
- return nil, errors.New("没有sql资源名称")
|
|
|
- }
|
|
|
-
|
|
|
- tableRows, err := executor.ExecuteRawSqlTemplate(name, executeParams, args...)
|
|
|
- if err != nil {
|
|
|
- return nil, err
|
|
|
- }
|
|
|
-
|
|
|
- return tableRows, nil
|
|
|
-}
|