From 804d5d5e59cc9e51d5d9bd91b57765ecb5794048 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=9F=E5=B8=85?= <133814250@qq.com> Date: Thu, 25 Jul 2024 16:47:59 +0800 Subject: [PATCH] =?UTF-8?q?perf=20=E6=94=B9=E8=BF=9B=E8=A1=A8=E6=A0=BC?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E3=80=81=E6=96=87=E4=BB=B6=E5=B1=95=E7=A4=BA?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E4=BD=BF=E7=94=A8=E6=96=B9=E5=BC=8F=EF=BC=8C?= =?UTF-8?q?=E5=87=8F=E5=B0=91=E5=86=97=E4=BD=99=20fix=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=94=9F=E6=88=90=E6=A0=91=E8=A1=A8=E6=97=B6=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E5=8A=A0=E8=BD=BD=E9=94=99=E8=AF=AF=20chore=20=E6=B8=85?= =?UTF-8?q?=E7=90=86=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81cli=E5=8C=85?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E6=B5=8B=E8=AF=95=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/api/admin/curddemo/curddemo.go | 4 +- .../admin/normaltreedemo/normaltreedemo.go | 4 +- .../admin/optiontreedemo/optiontreedemo.go | 4 +- .../controller/admin/sys/curd_demo.go | 4 +- .../controller/admin/sys/normal_tree_demo.go | 15 +++- .../controller/admin/sys/option_tree_demo.go | 15 +++- .../cmd/testdata/build/multiple/multiple.go | 5 -- .../cmd/testdata/build/single/main.go | 5 -- .../internal/cmd/testdata/build/varmap/go.mod | 12 --- .../internal/cmd/testdata/build/varmap/go.sum | 27 ------ .../cmd/testdata/build/varmap/main.go | 13 --- .../cmd/testdata/fix/fix25_content.go | 30 ------- .../api/dict/dict_add_new_ctrl_expect.gotest | 17 ---- .../add_new_ctrl/api/dict/dict_expect.go | 15 ---- .../add_new_ctrl/api/dict/v1/dict_type.go | 17 ---- .../add_new_ctrl/controller/dict/dict.go | 5 -- .../add_new_ctrl/controller/dict/dict_new.go | 15 ---- .../controller/dict/dict_v1_dict_type.go | 14 --- .../controller/dict/dict_v1_test_new.gotest | 17 ---- .../api/dict/dict_add_new_ctrl_expect.gotest | 17 ---- .../add_new_file/api/dict/dict_expect.go | 15 ---- .../add_new_file/api/dict/v1/dict_type.go | 17 ---- .../add_new_file/controller/dict/dict.go | 5 -- .../add_new_file/controller/dict/dict_new.go | 15 ---- .../controller/dict/dict_v1_dict_type.go | 14 --- .../controller/dict/dict_v1_test_new.gotest | 14 --- .../genctrl/api/article/article_expect.go | 24 ------ .../testdata/genctrl/api/article/v1/edit.go | 27 ------ .../testdata/genctrl/api/article/v1/get.go | 25 ------ .../testdata/genctrl/api/article/v2/edit.go | 31 ------- .../genctrl/controller/article/article.go | 5 -- .../genctrl/controller/article/article_new.go | 21 ----- .../controller/article/article_v1_create.go | 14 --- .../controller/article/article_v1_get_list.go | 14 --- .../controller/article/article_v1_get_one.go | 14 --- .../controller/article/article_v1_update.go | 14 --- .../controller/article/article_v2_create.go | 14 --- .../controller/article/article_v2_update.go | 14 --- .../generated_user/dao/internal/table_user.go | 85 ------------------- .../gendao/generated_user/dao/table_user.go | 27 ------ .../generated_user/model/do/table_user.go | 22 ----- .../generated_user/model/entity/table_user.go | 20 ----- .../dao/internal/table_user.go | 85 ------------------- .../dao/table_user.go | 27 ------ .../model/do/table_user.go | 22 ----- .../model/entity/table_user.go | 21 ----- .../dao/internal/table_user.go | 85 ------------------- .../dao/table_user.go | 27 ------ .../model/do/table_user.go | 22 ----- .../model/entity/table_user.go | 21 ----- .../internal/cmd/testdata/gendao/go.mod.txt | 32 ------- .../internal/cmd/testdata/gendao/user.tpl.sql | 10 --- .../genpbentity/generated/table_user.proto | 21 ----- .../table_user_snake_screaming.proto | 21 ----- .../cmd/testdata/genpbentity/user.tpl.sql | 10 --- .../genservice/logic/article/article.go | 47 ---------- .../genservice/logic/article/article_extra.go | 75 ---------------- .../genservice/logic/delivery/delivery_app.go | 38 --------- .../logic/delivery/delivery_cluster.go | 32 ------- .../testdata/genservice/logic/logic_expect.go | 11 --- .../testdata/genservice/logic/user/user.go | 49 ----------- .../testdata/genservice/service/article.go | 58 ------------- .../testdata/genservice/service/delivery.go | 55 ------------ .../cmd/testdata/genservice/service/user.go | 40 --------- .../cmd/testdata/issue/2572/config.yaml | 20 ----- .../issue/2572/dao/internal/user_3.go | 85 ------------------- .../issue/2572/dao/internal/user_4.go | 85 ------------------- .../cmd/testdata/issue/2572/dao/user_3.go | 27 ------ .../cmd/testdata/issue/2572/dao/user_4.go | 27 ------ .../testdata/issue/2572/model/do/user_3.go | 22 ----- .../testdata/issue/2572/model/do/user_4.go | 22 ----- .../issue/2572/model/entity/user_3.go | 20 ----- .../issue/2572/model/entity/user_4.go | 20 ----- .../internal/cmd/testdata/issue/2572/sql1.sql | 10 --- .../internal/cmd/testdata/issue/2572/sql2.sql | 10 --- .../cmd/testdata/issue/2616/config.yaml | 20 ----- .../issue/2616/dao/internal/user_1.go | 85 ------------------- .../issue/2616/dao/internal/user_2.go | 85 ------------------- .../issue/2616/dao/internal/user_3.go | 85 ------------------- .../issue/2616/dao/internal/user_4.go | 85 ------------------- .../cmd/testdata/issue/2616/dao/user_1.go | 29 ------- .../cmd/testdata/issue/2616/dao/user_2.go | 29 ------- .../cmd/testdata/issue/2616/dao/user_3.go | 27 ------ .../cmd/testdata/issue/2616/dao/user_4.go | 27 ------ .../testdata/issue/2616/model/do/user_3.go | 22 ----- .../testdata/issue/2616/model/do/user_4.go | 22 ----- .../issue/2616/model/entity/user_3.go | 20 ----- .../issue/2616/model/entity/user_4.go | 20 ----- .../internal/cmd/testdata/issue/2616/sql1.sql | 10 --- .../internal/cmd/testdata/issue/2616/sql2.sql | 10 --- .../cmd/testdata/issue/2746/issue_2746.go | 18 ---- .../internal/cmd/testdata/issue/2746/sql.sql | 9 -- .../cmd/testdata/issue/3459/config.yaml | 5 -- .../testdata/issue/3460/api/hello/hello.go | 26 ------ .../testdata/issue/3460/api/hello/v1/req.go | 37 -------- .../testdata/issue/3460/api/hello/v2/req.go | 37 -------- .../issue/3460/controller/hello/hello.go | 5 -- .../issue/3460/controller/hello/hello_new.go | 21 ----- .../3460/controller/hello/hello_v1_req.go | 23 ----- .../3460/controller/hello/hello_v2_req.go | 23 ----- .../cmd/testdata/issue/3545/table_user.proto | 21 ----- .../hggen/views/curd_generate_web_model.go | 22 ++--- server/internal/logic/sys/curd_demo.go | 4 +- server/internal/logic/sys/normal_tree_demo.go | 4 +- server/internal/logic/sys/option_tree_demo.go | 4 +- .../internal/model/input/sysin/curd_demo.go | 4 +- .../model/input/sysin/normal_tree_demo.go | 8 +- .../model/input/sysin/option_tree_demo.go | 4 +- server/internal/router/genrouter/curd_demo.go | 4 +- .../router/genrouter/normal_tree_demo.go | 4 +- .../router/genrouter/option_tree_demo.go | 4 +- .../default/curd/controller.go.template | 11 ++- web/src/utils/hotgo.ts | 13 +++ web/src/utils/index.ts | 72 +++++++++++++++- web/src/utils/is/index.ts | 9 +- web/src/views/curdDemo/edit.vue | 55 ++++++------ web/src/views/curdDemo/index.vue | 4 +- web/src/views/curdDemo/model.ts | 44 +++------- web/src/views/normalTreeDemo/edit.vue | 55 ++++++------ web/src/views/normalTreeDemo/index.vue | 4 +- web/src/views/normalTreeDemo/model.ts | 44 ++-------- 121 files changed, 238 insertions(+), 2799 deletions(-) delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/build/multiple/multiple.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/build/single/main.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/build/varmap/go.mod delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/build/varmap/go.sum delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/build/varmap/main.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/fix/fix25_content.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/dict_add_new_ctrl_expect.gotest delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/dict_expect.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1/dict_type.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_new.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_v1_dict_type.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_v1_test_new.gotest delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/dict_add_new_ctrl_expect.gotest delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/dict_expect.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1/dict_type.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_new.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_v1_dict_type.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_v1_test_new.gotest delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/article_expect.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1/edit.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1/get.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v2/edit.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_new.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_create.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_get_list.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_get_one.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_update.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v2_create.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v2_update.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/dao/internal/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/dao/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/model/do/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/model/entity/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/internal/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/model/do/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/model/entity/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/internal/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/model/do/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/model/entity/table_user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/go.mod.txt delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/gendao/user.tpl.sql delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genpbentity/generated/table_user.proto delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genpbentity/generated/table_user_snake_screaming.proto delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genpbentity/user.tpl.sql delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genservice/logic/article/article.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genservice/logic/article/article_extra.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genservice/logic/delivery/delivery_app.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genservice/logic/delivery/delivery_cluster.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genservice/logic/logic_expect.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genservice/logic/user/user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genservice/service/article.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genservice/service/delivery.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/genservice/service/user.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/config.yaml delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/internal/user_3.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/internal/user_4.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/user_3.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/user_4.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/do/user_3.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/do/user_4.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/entity/user_3.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/entity/user_4.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/sql1.sql delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2572/sql2.sql delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/config.yaml delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_1.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_2.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_3.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_4.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_1.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_2.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_3.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_4.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/do/user_3.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/do/user_4.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/entity/user_3.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/entity/user_4.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/sql1.sql delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2616/sql2.sql delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2746/issue_2746.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/2746/sql.sql delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/3459/config.yaml delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/hello.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v1/req.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v2/req.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_v1_req.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_v2_req.go delete mode 100644 server/internal/library/hggen/internal/cmd/testdata/issue/3545/table_user.proto diff --git a/server/api/admin/curddemo/curddemo.go b/server/api/admin/curddemo/curddemo.go index 733a5e5..7f51e2f 100644 --- a/server/api/admin/curddemo/curddemo.go +++ b/server/api/admin/curddemo/curddemo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package curddemo import ( @@ -82,4 +82,4 @@ type SwitchReq struct { sysin.CurdDemoSwitchInp } -type SwitchRes struct{} \ No newline at end of file +type SwitchRes struct{} diff --git a/server/api/admin/normaltreedemo/normaltreedemo.go b/server/api/admin/normaltreedemo/normaltreedemo.go index e6543df..62dff51 100644 --- a/server/api/admin/normaltreedemo/normaltreedemo.go +++ b/server/api/admin/normaltreedemo/normaltreedemo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package normaltreedemo import ( @@ -66,4 +66,4 @@ type TreeOptionReq struct { g.Meta `path:"/normalTreeDemo/treeOption" method:"get" tags:"普通树表" summary:"获取普通树表关系树选项"` } -type TreeOptionRes []tree.Node \ No newline at end of file +type TreeOptionRes []tree.Node diff --git a/server/api/admin/optiontreedemo/optiontreedemo.go b/server/api/admin/optiontreedemo/optiontreedemo.go index 34d2e0a..ce9c655 100644 --- a/server/api/admin/optiontreedemo/optiontreedemo.go +++ b/server/api/admin/optiontreedemo/optiontreedemo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package optiontreedemo import ( @@ -66,4 +66,4 @@ type TreeOptionReq struct { g.Meta `path:"/optionTreeDemo/treeOption" method:"get" tags:"选项树表" summary:"获取选项树表关系树选项"` } -type TreeOptionRes []tree.Node \ No newline at end of file +type TreeOptionRes []tree.Node diff --git a/server/internal/controller/admin/sys/curd_demo.go b/server/internal/controller/admin/sys/curd_demo.go index 416263a..20b34cf 100644 --- a/server/internal/controller/admin/sys/curd_demo.go +++ b/server/internal/controller/admin/sys/curd_demo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package sys import ( @@ -88,4 +88,4 @@ func (c *cCurdDemo) Status(ctx context.Context, req *curddemo.StatusReq) (res *c func (c *cCurdDemo) Switch(ctx context.Context, req *curddemo.SwitchReq) (res *curddemo.SwitchRes, err error) { err = service.SysCurdDemo().Switch(ctx, &req.CurdDemoSwitchInp) return -} \ No newline at end of file +} diff --git a/server/internal/controller/admin/sys/normal_tree_demo.go b/server/internal/controller/admin/sys/normal_tree_demo.go index 29841e3..7348d87 100644 --- a/server/internal/controller/admin/sys/normal_tree_demo.go +++ b/server/internal/controller/admin/sys/normal_tree_demo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package sys import ( @@ -75,6 +75,15 @@ func (c *cNormalTreeDemo) Delete(ctx context.Context, req *normaltreedemo.Delete // TreeOption 获取普通树表关系树选项 func (c *cNormalTreeDemo) TreeOption(ctx context.Context, req *normaltreedemo.TreeOptionReq) (res *normaltreedemo.TreeOptionRes, err error) { data, err := service.SysNormalTreeDemo().TreeOption(ctx) - res = (*normaltreedemo.TreeOptionRes)(&data) + if err != nil { + return nil, err + } + + if len(data) > 0 { + res = (*normaltreedemo.TreeOptionRes)(&data) + } else { + temp := make(normaltreedemo.TreeOptionRes, 0) + res = &temp + } return -} \ No newline at end of file +} diff --git a/server/internal/controller/admin/sys/option_tree_demo.go b/server/internal/controller/admin/sys/option_tree_demo.go index f0e94a6..93564f8 100644 --- a/server/internal/controller/admin/sys/option_tree_demo.go +++ b/server/internal/controller/admin/sys/option_tree_demo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package sys import ( @@ -75,6 +75,15 @@ func (c *cOptionTreeDemo) Delete(ctx context.Context, req *optiontreedemo.Delete // TreeOption 获取选项树表关系树选项 func (c *cOptionTreeDemo) TreeOption(ctx context.Context, req *optiontreedemo.TreeOptionReq) (res *optiontreedemo.TreeOptionRes, err error) { data, err := service.SysOptionTreeDemo().TreeOption(ctx) - res = (*optiontreedemo.TreeOptionRes)(&data) + if err != nil { + return nil, err + } + + if len(data) > 0 { + res = (*optiontreedemo.TreeOptionRes)(&data) + } else { + temp := make(optiontreedemo.TreeOptionRes, 0) + res = &temp + } return -} \ No newline at end of file +} diff --git a/server/internal/library/hggen/internal/cmd/testdata/build/multiple/multiple.go b/server/internal/library/hggen/internal/cmd/testdata/build/multiple/multiple.go deleted file mode 100644 index 7905807..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/build/multiple/multiple.go +++ /dev/null @@ -1,5 +0,0 @@ -package main - -func main() { - -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/build/single/main.go b/server/internal/library/hggen/internal/cmd/testdata/build/single/main.go deleted file mode 100644 index 7905807..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/build/single/main.go +++ /dev/null @@ -1,5 +0,0 @@ -package main - -func main() { - -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/build/varmap/go.mod b/server/internal/library/hggen/internal/cmd/testdata/build/varmap/go.mod deleted file mode 100644 index 7457292..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/build/varmap/go.mod +++ /dev/null @@ -1,12 +0,0 @@ -module github.com/gogf/gf/cmd/gf/cmd/gf/testdata/vardump/v2 - -go 1.18 - -require github.com/gogf/gf/v2 v2.6.1 - -require ( - go.opentelemetry.io/otel v1.14.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect -) - -replace github.com/gogf/gf/v2 => ../../../../../../../ diff --git a/server/internal/library/hggen/internal/cmd/testdata/build/varmap/go.sum b/server/internal/library/hggen/internal/cmd/testdata/build/varmap/go.sum deleted file mode 100644 index 4e5a51b..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/build/varmap/go.sum +++ /dev/null @@ -1,27 +0,0 @@ -github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= -github.com/clbanning/mxj/v2 v2.7.0 h1:WA/La7UGCanFe5NpHF0Q3DNtnCsVoxbPKuyBNHWRyME= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= -github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/grokify/html-strip-tags-go v0.1.0 h1:03UrQLjAny8xci+R+qjCce/MYnpNXCtgzltlQbOBae4= -github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= -github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= -go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= -go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= -go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= -go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/server/internal/library/hggen/internal/cmd/testdata/build/varmap/main.go b/server/internal/library/hggen/internal/cmd/testdata/build/varmap/main.go deleted file mode 100644 index 788a885..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/build/varmap/main.go +++ /dev/null @@ -1,13 +0,0 @@ -package main - -import ( - "fmt" - - "github.com/gogf/gf/v2/os/gbuild" -) - -func main() { - for k, v := range gbuild.Data() { - fmt.Printf("%s: %v\n", k, v) - } -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/fix/fix25_content.go b/server/internal/library/hggen/internal/cmd/testdata/fix/fix25_content.go deleted file mode 100644 index 934ebd2..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/fix/fix25_content.go +++ /dev/null @@ -1,30 +0,0 @@ -package testdata - -import ( - "fmt" - "testing" - "time" - - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/net/ghttp" - "github.com/gogf/gf/v2/test/gtest" - "github.com/gogf/gf/v2/util/guid" -) - -func Test_Router_Hook_Multi(t *testing.T) { - s := g.Server(guid.S()) - s.BindHandler("/multi-hook", func(r *ghttp.Request) { - r.Response.Write("show") - }) - - s.BindHookHandlerByMap("/multi-hook", map[string]ghttp.HandlerFunc{ - ghttp.HookBeforeServe: func(r *ghttp.Request) { - r.Response.Write("1") - }, - }) - s.BindHookHandlerByMap("/multi-hook/{id}", map[string]ghttp.HandlerFunc{ - ghttp.HookBeforeServe: func(r *ghttp.Request) { - r.Response.Write("2") - }, - }) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/dict_add_new_ctrl_expect.gotest b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/dict_add_new_ctrl_expect.gotest deleted file mode 100644 index fbe3e59..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/dict_add_new_ctrl_expect.gotest +++ /dev/null @@ -1,17 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package dict - -import ( - "context" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1" -) - -type IDictV1 interface { - DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) - DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error) -} - diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/dict_expect.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/dict_expect.go deleted file mode 100644 index bcfaad0..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/dict_expect.go +++ /dev/null @@ -1,15 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package dict - -import ( - "context" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1" -) - -type IDictV1 interface { - DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1/dict_type.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1/dict_type.go deleted file mode 100644 index 459ced8..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1/dict_type.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package v1 - -import "github.com/gogf/gf/v2/frame/g" - -type DictTypeAddPageReq struct { - g.Meta `path:"/dict/type/add" tags:"字典管理" method:"get" summary:"字典类型添加页面"` -} - -type DictTypeAddPageRes struct { - g.Meta `mime:"text/html" type:"string" example:""` -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict.go deleted file mode 100644 index b280a53..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict.go +++ /dev/null @@ -1,5 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dict diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_new.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_new.go deleted file mode 100644 index 2174be5..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_new.go +++ /dev/null @@ -1,15 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dict - -import ( - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict" -) - -type ControllerV1 struct{} - -func NewV1() dict.IDictV1 { - return &ControllerV1{} -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_v1_dict_type.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_v1_dict_type.go deleted file mode 100644 index 218228e..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_v1_dict_type.go +++ /dev/null @@ -1,14 +0,0 @@ -package dict - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1" -) - -func (c *ControllerV1) DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_v1_test_new.gotest b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_v1_test_new.gotest deleted file mode 100644 index 5e1a08d..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/controller/dict/dict_v1_test_new.gotest +++ /dev/null @@ -1,17 +0,0 @@ -package dict - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1" -) - -func (c *ControllerV1) DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} -func (c *ControllerV1) DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/dict_add_new_ctrl_expect.gotest b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/dict_add_new_ctrl_expect.gotest deleted file mode 100644 index fbe3e59..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/dict_add_new_ctrl_expect.gotest +++ /dev/null @@ -1,17 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package dict - -import ( - "context" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_ctrl/api/dict/v1" -) - -type IDictV1 interface { - DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) - DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error) -} - diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/dict_expect.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/dict_expect.go deleted file mode 100644 index 98f9fdb..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/dict_expect.go +++ /dev/null @@ -1,15 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package dict - -import ( - "context" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1" -) - -type IDictV1 interface { - DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1/dict_type.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1/dict_type.go deleted file mode 100644 index 459ced8..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1/dict_type.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package v1 - -import "github.com/gogf/gf/v2/frame/g" - -type DictTypeAddPageReq struct { - g.Meta `path:"/dict/type/add" tags:"字典管理" method:"get" summary:"字典类型添加页面"` -} - -type DictTypeAddPageRes struct { - g.Meta `mime:"text/html" type:"string" example:""` -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict.go deleted file mode 100644 index b280a53..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict.go +++ /dev/null @@ -1,5 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dict diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_new.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_new.go deleted file mode 100644 index b715880..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_new.go +++ /dev/null @@ -1,15 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dict - -import ( - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict" -) - -type ControllerV1 struct{} - -func NewV1() dict.IDictV1 { - return &ControllerV1{} -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_v1_dict_type.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_v1_dict_type.go deleted file mode 100644 index 229560c..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_v1_dict_type.go +++ /dev/null @@ -1,14 +0,0 @@ -package dict - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1" -) - -func (c *ControllerV1) DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_v1_test_new.gotest b/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_v1_test_new.gotest deleted file mode 100644 index a6386d7..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/controller/dict/dict_v1_test_new.gotest +++ /dev/null @@ -1,14 +0,0 @@ -package dict - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl-merge/add_new_file/api/dict/v1" -) - -func (c *ControllerV1) DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/article_expect.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/article_expect.go deleted file mode 100644 index 880d81f..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/article_expect.go +++ /dev/null @@ -1,24 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package article - -import ( - "context" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1" - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v2" -) - -type IArticleV1 interface { - Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) - Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) - GetList(ctx context.Context, req *v1.GetListReq) (res *v1.GetListRes, err error) - GetOne(ctx context.Context, req *v1.GetOneReq) (res *v1.GetOneRes, err error) -} - -type IArticleV2 interface { - Create(ctx context.Context, req *v2.CreateReq) (res *v2.CreateRes, err error) - Update(ctx context.Context, req *v2.UpdateReq) (res *v2.UpdateRes, err error) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1/edit.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1/edit.go deleted file mode 100644 index 9e893d8..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1/edit.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package v1 - -import "github.com/gogf/gf/v2/frame/g" - -type ( - CreateReq struct { - g.Meta `path:"/article/create" method:"post" tags:"ArticleService"` - Title string `v:"required"` - } - - CreateRes struct{} -) - -type ( - UpdateReq struct { - g.Meta `path:"/article/update" method:"post" tags:"ArticleService"` - Title string `v:"required"` - } - - UpdateRes struct{} -) diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1/get.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1/get.go deleted file mode 100644 index 36134f5..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1/get.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package v1 - -import "github.com/gogf/gf/v2/frame/g" - -type GetListReq struct { - g.Meta `path:"/article/list" method:"get" tags:"ArticleService"` -} - -type GetListRes struct { - list []struct{} -} - -type GetOneReq struct { - g.Meta `path:"/article/one" method:"get" tags:"ArticleService"` -} - -type GetOneRes struct { - one struct{} -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v2/edit.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v2/edit.go deleted file mode 100644 index 2ae2069..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v2/edit.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package v2 - -import "github.com/gogf/gf/v2/frame/g" - -type CreateReq struct { - g.Meta `path:"/article/create" method:"post" tags:"ArticleService"` - Title string `v:"required"` -} - -type CreateRes struct{} - -type UpdateReq struct { - g.Meta `path:"/article/update" method:"post" tags:"ArticleService"` - Title string `v:"required"` -} - -type UpdateRes struct{} - -//type GetListReq struct { -// g.Meta `path:"/article/list" method:"get" tags:"ArticleService"` -//} -// -//type GetListRes struct { -// list []struct{} -//} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article.go deleted file mode 100644 index 4bd478c..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article.go +++ /dev/null @@ -1,5 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package article diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_new.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_new.go deleted file mode 100644 index c4ac00e..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_new.go +++ /dev/null @@ -1,21 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package article - -import ( - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl/api/article" -) - -type ControllerV1 struct{} - -func NewV1() article.IArticleV1 { - return &ControllerV1{} -} - -type ControllerV2 struct{} - -func NewV2() article.IArticleV2 { - return &ControllerV2{} -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_create.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_create.go deleted file mode 100644 index 1b37e99..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_create.go +++ /dev/null @@ -1,14 +0,0 @@ -package article - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1" -) - -func (c *ControllerV1) Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_get_list.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_get_list.go deleted file mode 100644 index a0f48e8..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_get_list.go +++ /dev/null @@ -1,14 +0,0 @@ -package article - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1" -) - -func (c *ControllerV1) GetList(ctx context.Context, req *v1.GetListReq) (res *v1.GetListRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_get_one.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_get_one.go deleted file mode 100644 index e258f06..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_get_one.go +++ /dev/null @@ -1,14 +0,0 @@ -package article - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1" -) - -func (c *ControllerV1) GetOne(ctx context.Context, req *v1.GetOneReq) (res *v1.GetOneRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_update.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_update.go deleted file mode 100644 index 7919aa2..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v1_update.go +++ /dev/null @@ -1,14 +0,0 @@ -package article - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v1" -) - -func (c *ControllerV1) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v2_create.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v2_create.go deleted file mode 100644 index 7b435f2..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v2_create.go +++ /dev/null @@ -1,14 +0,0 @@ -package article - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v2" -) - -func (c *ControllerV2) Create(ctx context.Context, req *v2.CreateReq) (res *v2.CreateRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v2_update.go b/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v2_update.go deleted file mode 100644 index e91a6ac..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genctrl/controller/article/article_v2_update.go +++ /dev/null @@ -1,14 +0,0 @@ -package article - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genctrl/api/article/v2" -) - -func (c *ControllerV2) Update(ctx context.Context, req *v2.UpdateReq) (res *v2.UpdateRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/dao/internal/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/dao/internal/table_user.go deleted file mode 100644 index f883408..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/dao/internal/table_user.go +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -package internal - -import ( - "context" - - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/frame/g" -) - -// TableUserDao is the data access object for table table_user. -type TableUserDao struct { - table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. - columns TableUserColumns // columns contains all the column names of Table for convenient usage. -} - -// TableUserColumns defines and stores column names for table table_user. -type TableUserColumns struct { - Id string // User ID - Passport string // User Passport - Password string // User Password - Nickname string // User Nickname - Score string // Total score amount. - CreateAt string // Created Time - UpdateAt string // Updated Time -} - -// tableUserColumns holds the columns for table table_user. -var tableUserColumns = TableUserColumns{ - Id: "id", - Passport: "passport", - Password: "password", - Nickname: "nickname", - Score: "score", - CreateAt: "create_at", - UpdateAt: "update_at", -} - -// NewTableUserDao creates and returns a new DAO object for table data access. -func NewTableUserDao() *TableUserDao { - return &TableUserDao{ - group: "test", - table: "table_user", - columns: tableUserColumns, - } -} - -// DB retrieves and returns the underlying raw database management object of current DAO. -func (dao *TableUserDao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of current dao. -func (dao *TableUserDao) Table() string { - return dao.table -} - -// Columns returns all column names of current dao. -func (dao *TableUserDao) Columns() TableUserColumns { - return dao.columns -} - -// Group returns the configuration group name of database of current dao. -func (dao *TableUserDao) Group() string { - return dao.group -} - -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. -func (dao *TableUserDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) -} - -// Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. -// It commits the transaction and returns nil if function f returns nil. -// -// Note that, you should not Commit or Rollback the transaction in function f -// as it is automatically handled by this function. -func (dao *TableUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/dao/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/dao/table_user.go deleted file mode 100644 index 9bc9cff..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/dao/table_user.go +++ /dev/null @@ -1,27 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dao - -import ( - "for-gendao-test/pkg/dao/internal" -) - -// internalTableUserDao is internal type for wrapping internal DAO implements. -type internalTableUserDao = *internal.TableUserDao - -// tableUserDao is the data access object for table table_user. -// You can define custom methods on it to extend its functionality as you wish. -type tableUserDao struct { - internalTableUserDao -} - -var ( - // TableUser is globally public accessible object for table table_user operations. - TableUser = tableUserDao{ - internal.NewTableUserDao(), - } -) - -// Fill with you ideas below. diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/model/do/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/model/do/table_user.go deleted file mode 100644 index 656fb9c..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/model/do/table_user.go +++ /dev/null @@ -1,22 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package do - -import ( - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" -) - -// TableUser is the golang structure of table table_user for DAO operations like Where/Data. -type TableUser struct { - g.Meta `orm:"table:table_user, do:true"` - Id interface{} // User ID - Passport interface{} // User Passport - Password interface{} // User Password - Nickname interface{} // User Nickname - Score interface{} // Total score amount. - CreateAt *gtime.Time // Created Time - UpdateAt *gtime.Time // Updated Time -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/model/entity/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/model/entity/table_user.go deleted file mode 100644 index edde0ad..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user/model/entity/table_user.go +++ /dev/null @@ -1,20 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package entity - -import ( - "github.com/gogf/gf/v2/os/gtime" -) - -// TableUser is the golang structure for table table_user. -type TableUser struct { - Id uint `json:"ID" orm:"id" ` // User ID - Passport string `json:"PASSPORT" orm:"passport" ` // User Passport - Password string `json:"PASSWORD" orm:"password" ` // User Password - Nickname string `json:"NICKNAME" orm:"nickname" ` // User Nickname - Score float64 `json:"SCORE" orm:"score" ` // Total score amount. - CreateAt *gtime.Time `json:"CREATE_AT" orm:"create_at" ` // Created Time - UpdateAt *gtime.Time `json:"UPDATE_AT" orm:"update_at" ` // Updated Time -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/internal/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/internal/table_user.go deleted file mode 100644 index f883408..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/internal/table_user.go +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -package internal - -import ( - "context" - - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/frame/g" -) - -// TableUserDao is the data access object for table table_user. -type TableUserDao struct { - table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. - columns TableUserColumns // columns contains all the column names of Table for convenient usage. -} - -// TableUserColumns defines and stores column names for table table_user. -type TableUserColumns struct { - Id string // User ID - Passport string // User Passport - Password string // User Password - Nickname string // User Nickname - Score string // Total score amount. - CreateAt string // Created Time - UpdateAt string // Updated Time -} - -// tableUserColumns holds the columns for table table_user. -var tableUserColumns = TableUserColumns{ - Id: "id", - Passport: "passport", - Password: "password", - Nickname: "nickname", - Score: "score", - CreateAt: "create_at", - UpdateAt: "update_at", -} - -// NewTableUserDao creates and returns a new DAO object for table data access. -func NewTableUserDao() *TableUserDao { - return &TableUserDao{ - group: "test", - table: "table_user", - columns: tableUserColumns, - } -} - -// DB retrieves and returns the underlying raw database management object of current DAO. -func (dao *TableUserDao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of current dao. -func (dao *TableUserDao) Table() string { - return dao.table -} - -// Columns returns all column names of current dao. -func (dao *TableUserDao) Columns() TableUserColumns { - return dao.columns -} - -// Group returns the configuration group name of database of current dao. -func (dao *TableUserDao) Group() string { - return dao.group -} - -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. -func (dao *TableUserDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) -} - -// Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. -// It commits the transaction and returns nil if function f returns nil. -// -// Note that, you should not Commit or Rollback the transaction in function f -// as it is automatically handled by this function. -func (dao *TableUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/table_user.go deleted file mode 100644 index 9bc9cff..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/dao/table_user.go +++ /dev/null @@ -1,27 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dao - -import ( - "for-gendao-test/pkg/dao/internal" -) - -// internalTableUserDao is internal type for wrapping internal DAO implements. -type internalTableUserDao = *internal.TableUserDao - -// tableUserDao is the data access object for table table_user. -// You can define custom methods on it to extend its functionality as you wish. -type tableUserDao struct { - internalTableUserDao -} - -var ( - // TableUser is globally public accessible object for table table_user operations. - TableUser = tableUserDao{ - internal.NewTableUserDao(), - } -) - -// Fill with you ideas below. diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/model/do/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/model/do/table_user.go deleted file mode 100644 index 656fb9c..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/model/do/table_user.go +++ /dev/null @@ -1,22 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package do - -import ( - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" -) - -// TableUser is the golang structure of table table_user for DAO operations like Where/Data. -type TableUser struct { - g.Meta `orm:"table:table_user, do:true"` - Id interface{} // User ID - Passport interface{} // User Passport - Password interface{} // User Password - Nickname interface{} // User Nickname - Score interface{} // Total score amount. - CreateAt *gtime.Time // Created Time - UpdateAt *gtime.Time // Updated Time -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/model/entity/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/model/entity/table_user.go deleted file mode 100644 index c447af2..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_field_mapping/model/entity/table_user.go +++ /dev/null @@ -1,21 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package entity - -import ( - "github.com/gogf/gf/v2/os/gtime" - "github.com/shopspring/decimal" -) - -// TableUser is the golang structure for table table_user. -type TableUser struct { - Id int64 `json:"id" orm:"id" ` // User ID - Passport string `json:"passport" orm:"passport" ` // User Passport - Password string `json:"password" orm:"password" ` // User Password - Nickname string `json:"nickname" orm:"nickname" ` // User Nickname - Score decimal.Decimal `json:"score" orm:"score" ` // Total score amount. - CreateAt *gtime.Time `json:"createAt" orm:"create_at" ` // Created Time - UpdateAt *gtime.Time `json:"updateAt" orm:"update_at" ` // Updated Time -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/internal/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/internal/table_user.go deleted file mode 100644 index f883408..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/internal/table_user.go +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -package internal - -import ( - "context" - - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/frame/g" -) - -// TableUserDao is the data access object for table table_user. -type TableUserDao struct { - table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. - columns TableUserColumns // columns contains all the column names of Table for convenient usage. -} - -// TableUserColumns defines and stores column names for table table_user. -type TableUserColumns struct { - Id string // User ID - Passport string // User Passport - Password string // User Password - Nickname string // User Nickname - Score string // Total score amount. - CreateAt string // Created Time - UpdateAt string // Updated Time -} - -// tableUserColumns holds the columns for table table_user. -var tableUserColumns = TableUserColumns{ - Id: "id", - Passport: "passport", - Password: "password", - Nickname: "nickname", - Score: "score", - CreateAt: "create_at", - UpdateAt: "update_at", -} - -// NewTableUserDao creates and returns a new DAO object for table data access. -func NewTableUserDao() *TableUserDao { - return &TableUserDao{ - group: "test", - table: "table_user", - columns: tableUserColumns, - } -} - -// DB retrieves and returns the underlying raw database management object of current DAO. -func (dao *TableUserDao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of current dao. -func (dao *TableUserDao) Table() string { - return dao.table -} - -// Columns returns all column names of current dao. -func (dao *TableUserDao) Columns() TableUserColumns { - return dao.columns -} - -// Group returns the configuration group name of database of current dao. -func (dao *TableUserDao) Group() string { - return dao.group -} - -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. -func (dao *TableUserDao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) -} - -// Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. -// It commits the transaction and returns nil if function f returns nil. -// -// Note that, you should not Commit or Rollback the transaction in function f -// as it is automatically handled by this function. -func (dao *TableUserDao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/table_user.go deleted file mode 100644 index 9bc9cff..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/dao/table_user.go +++ /dev/null @@ -1,27 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dao - -import ( - "for-gendao-test/pkg/dao/internal" -) - -// internalTableUserDao is internal type for wrapping internal DAO implements. -type internalTableUserDao = *internal.TableUserDao - -// tableUserDao is the data access object for table table_user. -// You can define custom methods on it to extend its functionality as you wish. -type tableUserDao struct { - internalTableUserDao -} - -var ( - // TableUser is globally public accessible object for table table_user operations. - TableUser = tableUserDao{ - internal.NewTableUserDao(), - } -) - -// Fill with you ideas below. diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/model/do/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/model/do/table_user.go deleted file mode 100644 index 656fb9c..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/model/do/table_user.go +++ /dev/null @@ -1,22 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package do - -import ( - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" -) - -// TableUser is the golang structure of table table_user for DAO operations like Where/Data. -type TableUser struct { - g.Meta `orm:"table:table_user, do:true"` - Id interface{} // User ID - Passport interface{} // User Passport - Password interface{} // User Password - Nickname interface{} // User Nickname - Score interface{} // Total score amount. - CreateAt *gtime.Time // Created Time - UpdateAt *gtime.Time // Updated Time -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/model/entity/table_user.go b/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/model/entity/table_user.go deleted file mode 100644 index c447af2..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/generated_user_type_mapping/model/entity/table_user.go +++ /dev/null @@ -1,21 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package entity - -import ( - "github.com/gogf/gf/v2/os/gtime" - "github.com/shopspring/decimal" -) - -// TableUser is the golang structure for table table_user. -type TableUser struct { - Id int64 `json:"id" orm:"id" ` // User ID - Passport string `json:"passport" orm:"passport" ` // User Passport - Password string `json:"password" orm:"password" ` // User Password - Nickname string `json:"nickname" orm:"nickname" ` // User Nickname - Score decimal.Decimal `json:"score" orm:"score" ` // Total score amount. - CreateAt *gtime.Time `json:"createAt" orm:"create_at" ` // Created Time - UpdateAt *gtime.Time `json:"updateAt" orm:"update_at" ` // Updated Time -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/go.mod.txt b/server/internal/library/hggen/internal/cmd/testdata/gendao/go.mod.txt deleted file mode 100644 index c121305..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/go.mod.txt +++ /dev/null @@ -1,32 +0,0 @@ -module for-gendao-test/pkg - -go 1.18 - -require ( - github.com/gogf/gf/v2 v2.5.3 - github.com/shopspring/decimal v1.3.1 -) - -require ( - github.com/BurntSushi/toml v1.2.0 // indirect - github.com/clbanning/mxj/v2 v2.7.0 // indirect - github.com/fatih/color v1.15.0 // indirect - github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-logr/logr v1.2.4 // indirect - github.com/go-logr/stdr v1.2.2 // indirect - github.com/gorilla/websocket v1.5.0 // indirect - github.com/grokify/html-strip-tags-go v0.0.1 // indirect - github.com/magiconair/properties v1.8.6 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.19 // indirect - github.com/mattn/go-runewidth v0.0.15 // indirect - github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/rivo/uniseg v0.4.4 // indirect - go.opentelemetry.io/otel v1.14.0 // indirect - go.opentelemetry.io/otel/sdk v1.14.0 // indirect - go.opentelemetry.io/otel/trace v1.14.0 // indirect - golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) diff --git a/server/internal/library/hggen/internal/cmd/testdata/gendao/user.tpl.sql b/server/internal/library/hggen/internal/cmd/testdata/gendao/user.tpl.sql deleted file mode 100644 index f27fc11..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/gendao/user.tpl.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE `%s` ( - `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID', - `passport` varchar(45) NOT NULL COMMENT 'User Passport', - `password` varchar(45) NOT NULL COMMENT 'User Password', - `nickname` varchar(45) NOT NULL COMMENT 'User Nickname', - `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.', - `create_at` datetime DEFAULT NULL COMMENT 'Created Time', - `update_at` datetime DEFAULT NULL COMMENT 'Updated Time', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/server/internal/library/hggen/internal/cmd/testdata/genpbentity/generated/table_user.proto b/server/internal/library/hggen/internal/cmd/testdata/genpbentity/generated/table_user.proto deleted file mode 100644 index e5074b4..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genpbentity/generated/table_user.proto +++ /dev/null @@ -1,21 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -syntax = "proto3"; - -package unittest; - -option go_package = "unittest"; - -import "google/protobuf/timestamp.proto"; - -message TableUser { - uint32 Id = 1; // User ID - string Passport = 2; // User Passport - string Password = 3; // User Password - string Nickname = 4; // User Nickname - string Score = 5; // Total score amount. - google.protobuf.Timestamp CreateAt = 6; // Created Time - google.protobuf.Timestamp UpdateAt = 7; // Updated Time -} \ No newline at end of file diff --git a/server/internal/library/hggen/internal/cmd/testdata/genpbentity/generated/table_user_snake_screaming.proto b/server/internal/library/hggen/internal/cmd/testdata/genpbentity/generated/table_user_snake_screaming.proto deleted file mode 100644 index 365999e..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genpbentity/generated/table_user_snake_screaming.proto +++ /dev/null @@ -1,21 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -syntax = "proto3"; - -package unittest; - -option go_package = "unittest"; - -import "google/protobuf/timestamp.proto"; - -message TableUser { - uint32 ID = 1; // User ID - string PASSPORT = 2; // User Passport - string PASSWORD = 3; // User Password - string NICKNAME = 4; // User Nickname - string SCORE = 5; // Total score amount. - google.protobuf.Timestamp CREATE_AT = 6; // Created Time - google.protobuf.Timestamp UPDATE_AT = 7; // Updated Time -} \ No newline at end of file diff --git a/server/internal/library/hggen/internal/cmd/testdata/genpbentity/user.tpl.sql b/server/internal/library/hggen/internal/cmd/testdata/genpbentity/user.tpl.sql deleted file mode 100644 index f27fc11..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genpbentity/user.tpl.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE `%s` ( - `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID', - `passport` varchar(45) NOT NULL COMMENT 'User Passport', - `password` varchar(45) NOT NULL COMMENT 'User Password', - `nickname` varchar(45) NOT NULL COMMENT 'User Nickname', - `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.', - `create_at` datetime DEFAULT NULL COMMENT 'Created Time', - `update_at` datetime DEFAULT NULL COMMENT 'Updated Time', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/article/article.go b/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/article/article.go deleted file mode 100644 index 4bc5447..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/article/article.go +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package article - -import ( - "context" - "go/ast" - t "time" - - gdbalias "github.com/gogf/gf/v2/database/gdb" - "hotgo/internal/library/hggen/internal/cmd/testdata/genservice/service" -) - -type sArticle struct { -} - -func init() { - service.RegisterArticle(&sArticle{}) -} - -// Get article details -func (s *sArticle) Get(ctx context.Context, id uint) (info struct{}, err error) { - return struct{}{}, err -} - -// Create -/** - * create an article. - * @author oldme - */ -func (s *sArticle) Create(ctx context.Context, info struct{}) (id uint, err error) { - // Use time package to test alias import. - t.Now() - return id, err -} - -func (s *sArticle) A1o2(ctx context.Context, str string, a, b *ast.GoStmt) error { - return nil -} - -func (s *sArticle) B_2(ctx context.Context, db gdbalias.Raw) (err error) { - return nil -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/article/article_extra.go b/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/article/article_extra.go deleted file mode 100644 index b61cb06..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/article/article_extra.go +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package article - -// import ( -// "context" -// -// "hotgo/internal/library/hggen/internal/cmd/testdata/genservice/service" -// ) -import ( - "context" - - // This is a random comment - gdbas "github.com/gogf/gf/v2/database/gdb" - /** - * - */ - _ "github.com/gogf/gf/v2/os/gfile" -) - -// T1 random comment -func (s sArticle) T1(ctx context.Context, id, id2 uint) (gdb gdbas.Model, err error) { - g := gdbas.Model{} - return g, err -} - -// I'm a random comment - -// t2 random comment -func (s *sArticle) t2(ctx context.Context) (err error) { - /** - * random comment - * i (1). func (s *sArticle) t2(ctx context.Context) (err error) { /** 1883 - * - */ - _ = func(ctx2 context.Context) {} - return nil -} - -// T3 -/** - * random comment @*4213hHY1&%##%>< ? , . / -func (s *sArticle) T4(i interface{}) interface{} { - return nil -} - -/** - * func (s *sArticle) T4(i interface{}) interface{} { - * return nil - * } - */ diff --git a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/delivery/delivery_app.go b/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/delivery/delivery_app.go deleted file mode 100644 index edb42ec..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/delivery/delivery_app.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package delivery - -import ( - "context" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genservice/service" -) - -type sDeliveryApp struct{} - -func NewDeliveryApp() *sDeliveryApp { - return &sDeliveryApp{} -} - -func (s *sDeliveryApp) Create(ctx context.Context) (i service.IDeliveryCluster, err error) { - return -} - -func (s *sDeliveryApp) GetList(ctx context.Context, i service.IDeliveryCluster) (err error) { - service.Article().Get(ctx, 1) - return -} - -func (s *sDeliveryApp) GetOne(ctx context.Context) (err error) { - return -} - -func (s *sDeliveryApp) Delete(ctx context.Context) (err error) { - return -} - -func (s *sDeliveryApp) AA(ctx context.Context) (err error) { return } diff --git a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/delivery/delivery_cluster.go b/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/delivery/delivery_cluster.go deleted file mode 100644 index 4be21e7..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/delivery/delivery_cluster.go +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package delivery - -import ( - "context" - - gdbas "github.com/gogf/gf/v2/database/gdb" -) - -type sDeliveryCluster struct{} - -func NewDeliveryCluster() *sDeliveryCluster { - return &sDeliveryCluster{} -} - -// Create 自动创建Cluster及Project. -func (s *sDeliveryCluster) Create(ctx context.Context) (err error, gdb gdbas.Model) { - return -} - -func (s *sDeliveryCluster) Delete(ctx context.Context) (err error) { - return -} - -func (s *sDeliveryCluster) GetList(ctx context.Context) (err error) { - return -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/logic_expect.go b/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/logic_expect.go deleted file mode 100644 index 6175855..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/logic_expect.go +++ /dev/null @@ -1,11 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -package logic - -import ( - _ "hotgo/internal/library/hggen/internal/cmd/testdata/genservice/logic/article" - _ "hotgo/internal/library/hggen/internal/cmd/testdata/genservice/logic/delivery" - _ "hotgo/internal/library/hggen/internal/cmd/testdata/genservice/logic/user" -) diff --git a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/user/user.go b/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/user/user.go deleted file mode 100644 index 337c0cc..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genservice/logic/user/user.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package user - -import ( - "context" - - "hotgo/internal/library/hggen/internal/cmd/testdata/genservice/service" -) - -func init() { - service.RegisterUser(New()) -} - -type sUser struct { -} - -func New() *sUser { - return &sUser{} -} - -// Create creates a new user. -func (s *sUser) Create(ctx context.Context, name string) (id int, err error) { - return 0, nil -} - -// GetOne retrieves user by id. -func (s *sUser) GetOne(ctx context.Context, id int) (name string, err error) { - return "", nil -} - -// GetList retrieves user list. -func (s *sUser) GetList(ctx context.Context) (names []string, err error) { - return nil, nil -} - -// Update updates user by id. -func (s *sUser) Update(ctx context.Context, id int) (name string, err error) { - return "", nil -} - -// Delete deletes user by id. -func (s *sUser) Delete(ctx context.Context, id int) (err error) { - return nil -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genservice/service/article.go b/server/internal/library/hggen/internal/cmd/testdata/genservice/service/article.go deleted file mode 100644 index 0d10924..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genservice/service/article.go +++ /dev/null @@ -1,58 +0,0 @@ -// ================================================================================ -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// You can delete these comments if you wish manually maintain this interface file. -// ================================================================================ - -package service - -import ( - "context" - "go/ast" - - gdbalias "github.com/gogf/gf/v2/database/gdb" - gdbas "github.com/gogf/gf/v2/database/gdb" -) - -type ( - IArticle interface { - // Get article details - Get(ctx context.Context, id uint) (info struct{}, err error) - // Create - /** - * create an article. - * @author oldme - */ - Create(ctx context.Context, info struct{}) (id uint, err error) - A1o2(ctx context.Context, str string, a *ast.GoStmt, b *ast.GoStmt) error - B_2(ctx context.Context, db gdbalias.Raw) (err error) - // T1 random comment - T1(ctx context.Context, id uint, id2 uint) (gdb gdbas.Model, err error) - // T3 - /** - * random comment @*4213hHY1&%##%>< ? , . / - T4(i interface{}) interface{} - } -) - -var ( - localArticle IArticle -) - -func Article() IArticle { - if localArticle == nil { - panic("implement not found for interface IArticle, forgot register?") - } - return localArticle -} - -func RegisterArticle(i IArticle) { - localArticle = i -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genservice/service/delivery.go b/server/internal/library/hggen/internal/cmd/testdata/genservice/service/delivery.go deleted file mode 100644 index 842ed88..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genservice/service/delivery.go +++ /dev/null @@ -1,55 +0,0 @@ -// ================================================================================ -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// You can delete these comments if you wish manually maintain this interface file. -// ================================================================================ - -package service - -import ( - "context" - - gdbas "github.com/gogf/gf/v2/database/gdb" -) - -type ( - IDeliveryApp interface { - Create(ctx context.Context) (i IDeliveryCluster, err error) - GetList(ctx context.Context, i IDeliveryCluster) (err error) - GetOne(ctx context.Context) (err error) - Delete(ctx context.Context) (err error) - AA(ctx context.Context) (err error) - } - IDeliveryCluster interface { - // Create 自动创建Cluster及Project. - Create(ctx context.Context) (err error, gdb gdbas.Model) - Delete(ctx context.Context) (err error) - GetList(ctx context.Context) (err error) - } -) - -var ( - localDeliveryApp IDeliveryApp - localDeliveryCluster IDeliveryCluster -) - -func DeliveryApp() IDeliveryApp { - if localDeliveryApp == nil { - panic("implement not found for interface IDeliveryApp, forgot register?") - } - return localDeliveryApp -} - -func RegisterDeliveryApp(i IDeliveryApp) { - localDeliveryApp = i -} - -func DeliveryCluster() IDeliveryCluster { - if localDeliveryCluster == nil { - panic("implement not found for interface IDeliveryCluster, forgot register?") - } - return localDeliveryCluster -} - -func RegisterDeliveryCluster(i IDeliveryCluster) { - localDeliveryCluster = i -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/genservice/service/user.go b/server/internal/library/hggen/internal/cmd/testdata/genservice/service/user.go deleted file mode 100644 index 731ee87..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/genservice/service/user.go +++ /dev/null @@ -1,40 +0,0 @@ -// ================================================================================ -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// You can delete these comments if you wish manually maintain this interface file. -// ================================================================================ - -package service - -import ( - "context" -) - -type ( - IUser interface { - // Create creates a new user. - Create(ctx context.Context, name string) (id int, err error) - // GetOne retrieves user by id. - GetOne(ctx context.Context, id int) (name string, err error) - // GetList retrieves user list. - GetList(ctx context.Context) (names []string, err error) - // Update updates user by id. - Update(ctx context.Context, id int) (name string, err error) - // Delete deletes user by id. - Delete(ctx context.Context, id int) (err error) - } -) - -var ( - localUser IUser -) - -func User() IUser { - if localUser == nil { - panic("implement not found for interface IUser, forgot register?") - } - return localUser -} - -func RegisterUser(i IUser) { - localUser = i -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/config.yaml b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/config.yaml deleted file mode 100644 index 82e437f..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/config.yaml +++ /dev/null @@ -1,20 +0,0 @@ -gfcli: - gen: - dao: - - link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test" - tables: "user1" - descriptionTag: true - noModelComment: true - group: "sys" - clear: true - overwriteDao: true - - link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test" - tables: "user2" - descriptionTag: true - noModelComment: true - group: "book" - clear: true - overwriteDao: true - - - diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/internal/user_3.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/internal/user_3.go deleted file mode 100644 index db59440..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/internal/user_3.go +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -package internal - -import ( - "context" - - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/frame/g" -) - -// User3Dao is the data access object for table user3. -type User3Dao struct { - table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. - columns User3Columns // columns contains all the column names of Table for convenient usage. -} - -// User3Columns defines and stores column names for table user3. -type User3Columns struct { - Id string // User ID - Passport string // User Passport - Password string // User Password - Nickname string // User Nickname - Score string // Total score amount. - CreateAt string // Created Time - UpdateAt string // Updated Time -} - -// user3Columns holds the columns for table user3. -var user3Columns = User3Columns{ - Id: "id", - Passport: "passport", - Password: "password", - Nickname: "nickname", - Score: "score", - CreateAt: "create_at", - UpdateAt: "update_at", -} - -// NewUser3Dao creates and returns a new DAO object for table data access. -func NewUser3Dao() *User3Dao { - return &User3Dao{ - group: "sys", - table: "user3", - columns: user3Columns, - } -} - -// DB retrieves and returns the underlying raw database management object of current DAO. -func (dao *User3Dao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of current dao. -func (dao *User3Dao) Table() string { - return dao.table -} - -// Columns returns all column names of current dao. -func (dao *User3Dao) Columns() User3Columns { - return dao.columns -} - -// Group returns the configuration group name of database of current dao. -func (dao *User3Dao) Group() string { - return dao.group -} - -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. -func (dao *User3Dao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) -} - -// Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. -// It commits the transaction and returns nil if function f returns nil. -// -// Note that, you should not Commit or Rollback the transaction in function f -// as it is automatically handled by this function. -func (dao *User3Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/internal/user_4.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/internal/user_4.go deleted file mode 100644 index 0488034..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/internal/user_4.go +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -package internal - -import ( - "context" - - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/frame/g" -) - -// User4Dao is the data access object for table user4. -type User4Dao struct { - table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. - columns User4Columns // columns contains all the column names of Table for convenient usage. -} - -// User4Columns defines and stores column names for table user4. -type User4Columns struct { - Id string // User ID - Passport string // User Passport - Password string // User Password - Nickname string // User Nickname - Score string // Total score amount. - CreateAt string // Created Time - UpdateAt string // Updated Time -} - -// user4Columns holds the columns for table user4. -var user4Columns = User4Columns{ - Id: "id", - Passport: "passport", - Password: "password", - Nickname: "nickname", - Score: "score", - CreateAt: "create_at", - UpdateAt: "update_at", -} - -// NewUser4Dao creates and returns a new DAO object for table data access. -func NewUser4Dao() *User4Dao { - return &User4Dao{ - group: "book", - table: "user4", - columns: user4Columns, - } -} - -// DB retrieves and returns the underlying raw database management object of current DAO. -func (dao *User4Dao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of current dao. -func (dao *User4Dao) Table() string { - return dao.table -} - -// Columns returns all column names of current dao. -func (dao *User4Dao) Columns() User4Columns { - return dao.columns -} - -// Group returns the configuration group name of database of current dao. -func (dao *User4Dao) Group() string { - return dao.group -} - -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. -func (dao *User4Dao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) -} - -// Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. -// It commits the transaction and returns nil if function f returns nil. -// -// Note that, you should not Commit or Rollback the transaction in function f -// as it is automatically handled by this function. -func (dao *User4Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/user_3.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/user_3.go deleted file mode 100644 index 375276e..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/user_3.go +++ /dev/null @@ -1,27 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dao - -import ( - "/internal" -) - -// internalUser3Dao is internal type for wrapping internal DAO implements. -type internalUser3Dao = *internal.User3Dao - -// user3Dao is the data access object for table user3. -// You can define custom methods on it to extend its functionality as you wish. -type user3Dao struct { - internalUser3Dao -} - -var ( - // User3 is globally public accessible object for table user3 operations. - User3 = user3Dao{ - internal.NewUser3Dao(), - } -) - -// Fill with you ideas below. diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/user_4.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/user_4.go deleted file mode 100644 index 7d02359..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/dao/user_4.go +++ /dev/null @@ -1,27 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dao - -import ( - "/internal" -) - -// internalUser4Dao is internal type for wrapping internal DAO implements. -type internalUser4Dao = *internal.User4Dao - -// user4Dao is the data access object for table user4. -// You can define custom methods on it to extend its functionality as you wish. -type user4Dao struct { - internalUser4Dao -} - -var ( - // User4 is globally public accessible object for table user4 operations. - User4 = user4Dao{ - internal.NewUser4Dao(), - } -) - -// Fill with you ideas below. diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/do/user_3.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/do/user_3.go deleted file mode 100644 index 14a1bf4..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/do/user_3.go +++ /dev/null @@ -1,22 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package do - -import ( - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" -) - -// User1 is the golang structure of table user1 for DAO operations like Where/Data. -type User1 struct { - g.Meta `orm:"table:user1, do:true"` - Id interface{} // User ID - Passport interface{} // User Passport - Password interface{} // User Password - Nickname interface{} // User Nickname - Score interface{} // Total score amount. - CreateAt *gtime.Time // Created Time - UpdateAt *gtime.Time // Updated Time -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/do/user_4.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/do/user_4.go deleted file mode 100644 index 8019772..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/do/user_4.go +++ /dev/null @@ -1,22 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package do - -import ( - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" -) - -// User2 is the golang structure of table user2 for DAO operations like Where/Data. -type User2 struct { - g.Meta `orm:"table:user2, do:true"` - Id interface{} // User ID - Passport interface{} // User Passport - Password interface{} // User Password - Nickname interface{} // User Nickname - Score interface{} // Total score amount. - CreateAt *gtime.Time // Created Time - UpdateAt *gtime.Time // Updated Time -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/entity/user_3.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/entity/user_3.go deleted file mode 100644 index de4cd54..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/entity/user_3.go +++ /dev/null @@ -1,20 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package entity - -import ( - "github.com/gogf/gf/v2/os/gtime" -) - -// User1 is the golang structure for table user1. -type User1 struct { - Id uint `json:"ID" description:"User ID"` - Passport string `json:"PASSPORT" description:"User Passport"` - Password string `json:"PASSWORD" description:"User Password"` - Nickname string `json:"NICKNAME" description:"User Nickname"` - Score float64 `json:"SCORE" description:"Total score amount."` - CreateAt *gtime.Time `json:"CREATE_AT" description:"Created Time"` - UpdateAt *gtime.Time `json:"UPDATE_AT" description:"Updated Time"` -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/entity/user_4.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/entity/user_4.go deleted file mode 100644 index 4727f62..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/model/entity/user_4.go +++ /dev/null @@ -1,20 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package entity - -import ( - "github.com/gogf/gf/v2/os/gtime" -) - -// User2 is the golang structure for table user2. -type User2 struct { - Id uint `json:"ID" description:"User ID"` - Passport string `json:"PASSPORT" description:"User Passport"` - Password string `json:"PASSWORD" description:"User Password"` - Nickname string `json:"NICKNAME" description:"User Nickname"` - Score float64 `json:"SCORE" description:"Total score amount."` - CreateAt *gtime.Time `json:"CREATE_AT" description:"Created Time"` - UpdateAt *gtime.Time `json:"UPDATE_AT" description:"Updated Time"` -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/sql1.sql b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/sql1.sql deleted file mode 100644 index 2877f1f..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/sql1.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE `user1` ( - `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID', - `passport` varchar(45) NOT NULL COMMENT 'User Passport', - `password` varchar(45) NOT NULL COMMENT 'User Password', - `nickname` varchar(45) NOT NULL COMMENT 'User Nickname', - `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.', - `create_at` datetime DEFAULT NULL COMMENT 'Created Time', - `update_at` datetime DEFAULT NULL COMMENT 'Updated Time', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/sql2.sql b/server/internal/library/hggen/internal/cmd/testdata/issue/2572/sql2.sql deleted file mode 100644 index ca450aa..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2572/sql2.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE `user2` ( - `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID', - `passport` varchar(45) NOT NULL COMMENT 'User Passport', - `password` varchar(45) NOT NULL COMMENT 'User Password', - `nickname` varchar(45) NOT NULL COMMENT 'User Nickname', - `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.', - `create_at` datetime DEFAULT NULL COMMENT 'Created Time', - `update_at` datetime DEFAULT NULL COMMENT 'Updated Time', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/config.yaml b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/config.yaml deleted file mode 100644 index fc6299a..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/config.yaml +++ /dev/null @@ -1,20 +0,0 @@ -gfcli: - gen: - dao: - - link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test" - tables: "user1" - descriptionTag: true - noModelComment: true - group: "sys" - clear: true - overwriteDao: false - - link: "mysql:root:12345678@tcp(127.0.0.1:3306)/test" - tables: "user2" - descriptionTag: true - noModelComment: true - group: "book" - clear: true - overwriteDao: true - - - diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_1.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_1.go deleted file mode 100644 index 9988251..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_1.go +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -package internal - -import ( - "context" - - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/frame/g" -) - -// User1Dao is the data access object for table user1. -type User1Dao struct { - table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. - columns User1Columns // columns contains all the column names of Table for convenient usage. -} - -// User1Columns defines and stores column names for table user1. -type User1Columns struct { - Id string // User ID - Passport string // User Passport - Password string // User Password - Nickname string // User Nickname - Score string // Total score amount. - CreateAt string // Created Time - UpdateAt string // Updated Time -} - -// user1Columns holds the columns for table user1. -var user1Columns = User1Columns{ - Id: "id", - Passport: "passport", - Password: "password", - Nickname: "nickname", - Score: "score", - CreateAt: "create_at", - UpdateAt: "update_at", -} - -// NewUser1Dao creates and returns a new DAO object for table data access. -func NewUser1Dao() *User1Dao { - return &User1Dao{ - group: "sys", - table: "user1", - columns: user1Columns, - } -} - -// DB retrieves and returns the underlying raw database management object of current DAO. -func (dao *User1Dao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of current dao. -func (dao *User1Dao) Table() string { - return dao.table -} - -// Columns returns all column names of current dao. -func (dao *User1Dao) Columns() User1Columns { - return dao.columns -} - -// Group returns the configuration group name of database of current dao. -func (dao *User1Dao) Group() string { - return dao.group -} - -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. -func (dao *User1Dao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) -} - -// Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. -// It commits the transaction and returns nil if function f returns nil. -// -// Note that, you should not Commit or Rollback the transaction in function f -// as it is automatically handled by this function. -func (dao *User1Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_2.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_2.go deleted file mode 100644 index 7e9cf2f..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_2.go +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -package internal - -import ( - "context" - - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/frame/g" -) - -// User2Dao is the data access object for table user2. -type User2Dao struct { - table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. - columns User2Columns // columns contains all the column names of Table for convenient usage. -} - -// User2Columns defines and stores column names for table user2. -type User2Columns struct { - Id string // User ID - Passport string // User Passport - Password string // User Password - Nickname string // User Nickname - Score string // Total score amount. - CreateAt string // Created Time - UpdateAt string // Updated Time -} - -// user2Columns holds the columns for table user2. -var user2Columns = User2Columns{ - Id: "id", - Passport: "passport", - Password: "password", - Nickname: "nickname", - Score: "score", - CreateAt: "create_at", - UpdateAt: "update_at", -} - -// NewUser2Dao creates and returns a new DAO object for table data access. -func NewUser2Dao() *User2Dao { - return &User2Dao{ - group: "sys", - table: "user2", - columns: user2Columns, - } -} - -// DB retrieves and returns the underlying raw database management object of current DAO. -func (dao *User2Dao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of current dao. -func (dao *User2Dao) Table() string { - return dao.table -} - -// Columns returns all column names of current dao. -func (dao *User2Dao) Columns() User2Columns { - return dao.columns -} - -// Group returns the configuration group name of database of current dao. -func (dao *User2Dao) Group() string { - return dao.group -} - -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. -func (dao *User2Dao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) -} - -// Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. -// It commits the transaction and returns nil if function f returns nil. -// -// Note that, you should not Commit or Rollback the transaction in function f -// as it is automatically handled by this function. -func (dao *User2Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_3.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_3.go deleted file mode 100644 index db59440..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_3.go +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -package internal - -import ( - "context" - - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/frame/g" -) - -// User3Dao is the data access object for table user3. -type User3Dao struct { - table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. - columns User3Columns // columns contains all the column names of Table for convenient usage. -} - -// User3Columns defines and stores column names for table user3. -type User3Columns struct { - Id string // User ID - Passport string // User Passport - Password string // User Password - Nickname string // User Nickname - Score string // Total score amount. - CreateAt string // Created Time - UpdateAt string // Updated Time -} - -// user3Columns holds the columns for table user3. -var user3Columns = User3Columns{ - Id: "id", - Passport: "passport", - Password: "password", - Nickname: "nickname", - Score: "score", - CreateAt: "create_at", - UpdateAt: "update_at", -} - -// NewUser3Dao creates and returns a new DAO object for table data access. -func NewUser3Dao() *User3Dao { - return &User3Dao{ - group: "sys", - table: "user3", - columns: user3Columns, - } -} - -// DB retrieves and returns the underlying raw database management object of current DAO. -func (dao *User3Dao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of current dao. -func (dao *User3Dao) Table() string { - return dao.table -} - -// Columns returns all column names of current dao. -func (dao *User3Dao) Columns() User3Columns { - return dao.columns -} - -// Group returns the configuration group name of database of current dao. -func (dao *User3Dao) Group() string { - return dao.group -} - -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. -func (dao *User3Dao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) -} - -// Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. -// It commits the transaction and returns nil if function f returns nil. -// -// Note that, you should not Commit or Rollback the transaction in function f -// as it is automatically handled by this function. -func (dao *User3Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_4.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_4.go deleted file mode 100644 index 0488034..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/internal/user_4.go +++ /dev/null @@ -1,85 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -package internal - -import ( - "context" - - "github.com/gogf/gf/v2/database/gdb" - "github.com/gogf/gf/v2/frame/g" -) - -// User4Dao is the data access object for table user4. -type User4Dao struct { - table string // table is the underlying table name of the DAO. - group string // group is the database configuration group name of current DAO. - columns User4Columns // columns contains all the column names of Table for convenient usage. -} - -// User4Columns defines and stores column names for table user4. -type User4Columns struct { - Id string // User ID - Passport string // User Passport - Password string // User Password - Nickname string // User Nickname - Score string // Total score amount. - CreateAt string // Created Time - UpdateAt string // Updated Time -} - -// user4Columns holds the columns for table user4. -var user4Columns = User4Columns{ - Id: "id", - Passport: "passport", - Password: "password", - Nickname: "nickname", - Score: "score", - CreateAt: "create_at", - UpdateAt: "update_at", -} - -// NewUser4Dao creates and returns a new DAO object for table data access. -func NewUser4Dao() *User4Dao { - return &User4Dao{ - group: "book", - table: "user4", - columns: user4Columns, - } -} - -// DB retrieves and returns the underlying raw database management object of current DAO. -func (dao *User4Dao) DB() gdb.DB { - return g.DB(dao.group) -} - -// Table returns the table name of current dao. -func (dao *User4Dao) Table() string { - return dao.table -} - -// Columns returns all column names of current dao. -func (dao *User4Dao) Columns() User4Columns { - return dao.columns -} - -// Group returns the configuration group name of database of current dao. -func (dao *User4Dao) Group() string { - return dao.group -} - -// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation. -func (dao *User4Dao) Ctx(ctx context.Context) *gdb.Model { - return dao.DB().Model(dao.table).Safe().Ctx(ctx) -} - -// Transaction wraps the transaction logic using function f. -// It rollbacks the transaction and returns the error from function f if it returns non-nil error. -// It commits the transaction and returns nil if function f returns nil. -// -// Note that, you should not Commit or Rollback the transaction in function f -// as it is automatically handled by this function. -func (dao *User4Dao) Transaction(ctx context.Context, f func(ctx context.Context, tx gdb.TX) error) (err error) { - return dao.Ctx(ctx).Transaction(ctx, f) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_1.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_1.go deleted file mode 100644 index 69af67a..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_1.go +++ /dev/null @@ -1,29 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -// I am not overwritten. - -package dao - -import ( - "/internal" -) - -// internalUser1Dao is internal type for wrapping internal DAO implements. -type internalUser1Dao = *internal.User1Dao - -// user1Dao is the data access object for table user1. -// You can define custom methods on it to extend its functionality as you wish. -type user1Dao struct { - internalUser1Dao -} - -var ( - // User1 is globally public accessible object for table user1 operations. - User1 = user1Dao{ - internal.NewUser1Dao(), - } -) - -// Fill with you ideas below. diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_2.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_2.go deleted file mode 100644 index 895d406..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_2.go +++ /dev/null @@ -1,29 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -// I am not overwritten. - -package dao - -import ( - "/internal" -) - -// internalUser2Dao is internal type for wrapping internal DAO implements. -type internalUser2Dao = *internal.User2Dao - -// user2Dao is the data access object for table user2. -// You can define custom methods on it to extend its functionality as you wish. -type user2Dao struct { - internalUser2Dao -} - -var ( - // User2 is globally public accessible object for table user2 operations. - User2 = user2Dao{ - internal.NewUser2Dao(), - } -) - -// Fill with you ideas below. diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_3.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_3.go deleted file mode 100644 index 375276e..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_3.go +++ /dev/null @@ -1,27 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dao - -import ( - "/internal" -) - -// internalUser3Dao is internal type for wrapping internal DAO implements. -type internalUser3Dao = *internal.User3Dao - -// user3Dao is the data access object for table user3. -// You can define custom methods on it to extend its functionality as you wish. -type user3Dao struct { - internalUser3Dao -} - -var ( - // User3 is globally public accessible object for table user3 operations. - User3 = user3Dao{ - internal.NewUser3Dao(), - } -) - -// Fill with you ideas below. diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_4.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_4.go deleted file mode 100644 index 7d02359..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/dao/user_4.go +++ /dev/null @@ -1,27 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package dao - -import ( - "/internal" -) - -// internalUser4Dao is internal type for wrapping internal DAO implements. -type internalUser4Dao = *internal.User4Dao - -// user4Dao is the data access object for table user4. -// You can define custom methods on it to extend its functionality as you wish. -type user4Dao struct { - internalUser4Dao -} - -var ( - // User4 is globally public accessible object for table user4 operations. - User4 = user4Dao{ - internal.NewUser4Dao(), - } -) - -// Fill with you ideas below. diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/do/user_3.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/do/user_3.go deleted file mode 100644 index 14a1bf4..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/do/user_3.go +++ /dev/null @@ -1,22 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package do - -import ( - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" -) - -// User1 is the golang structure of table user1 for DAO operations like Where/Data. -type User1 struct { - g.Meta `orm:"table:user1, do:true"` - Id interface{} // User ID - Passport interface{} // User Passport - Password interface{} // User Password - Nickname interface{} // User Nickname - Score interface{} // Total score amount. - CreateAt *gtime.Time // Created Time - UpdateAt *gtime.Time // Updated Time -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/do/user_4.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/do/user_4.go deleted file mode 100644 index 8019772..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/do/user_4.go +++ /dev/null @@ -1,22 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package do - -import ( - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gtime" -) - -// User2 is the golang structure of table user2 for DAO operations like Where/Data. -type User2 struct { - g.Meta `orm:"table:user2, do:true"` - Id interface{} // User ID - Passport interface{} // User Passport - Password interface{} // User Password - Nickname interface{} // User Nickname - Score interface{} // Total score amount. - CreateAt *gtime.Time // Created Time - UpdateAt *gtime.Time // Updated Time -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/entity/user_3.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/entity/user_3.go deleted file mode 100644 index de4cd54..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/entity/user_3.go +++ /dev/null @@ -1,20 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package entity - -import ( - "github.com/gogf/gf/v2/os/gtime" -) - -// User1 is the golang structure for table user1. -type User1 struct { - Id uint `json:"ID" description:"User ID"` - Passport string `json:"PASSPORT" description:"User Passport"` - Password string `json:"PASSWORD" description:"User Password"` - Nickname string `json:"NICKNAME" description:"User Nickname"` - Score float64 `json:"SCORE" description:"Total score amount."` - CreateAt *gtime.Time `json:"CREATE_AT" description:"Created Time"` - UpdateAt *gtime.Time `json:"UPDATE_AT" description:"Updated Time"` -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/entity/user_4.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/entity/user_4.go deleted file mode 100644 index 4727f62..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/model/entity/user_4.go +++ /dev/null @@ -1,20 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package entity - -import ( - "github.com/gogf/gf/v2/os/gtime" -) - -// User2 is the golang structure for table user2. -type User2 struct { - Id uint `json:"ID" description:"User ID"` - Passport string `json:"PASSPORT" description:"User Passport"` - Password string `json:"PASSWORD" description:"User Password"` - Nickname string `json:"NICKNAME" description:"User Nickname"` - Score float64 `json:"SCORE" description:"Total score amount."` - CreateAt *gtime.Time `json:"CREATE_AT" description:"Created Time"` - UpdateAt *gtime.Time `json:"UPDATE_AT" description:"Updated Time"` -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/sql1.sql b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/sql1.sql deleted file mode 100644 index 2877f1f..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/sql1.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE `user1` ( - `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID', - `passport` varchar(45) NOT NULL COMMENT 'User Passport', - `password` varchar(45) NOT NULL COMMENT 'User Password', - `nickname` varchar(45) NOT NULL COMMENT 'User Nickname', - `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.', - `create_at` datetime DEFAULT NULL COMMENT 'Created Time', - `update_at` datetime DEFAULT NULL COMMENT 'Updated Time', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/sql2.sql b/server/internal/library/hggen/internal/cmd/testdata/issue/2616/sql2.sql deleted file mode 100644 index ca450aa..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2616/sql2.sql +++ /dev/null @@ -1,10 +0,0 @@ -CREATE TABLE `user2` ( - `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID', - `passport` varchar(45) NOT NULL COMMENT 'User Passport', - `password` varchar(45) NOT NULL COMMENT 'User Password', - `nickname` varchar(45) NOT NULL COMMENT 'User Nickname', - `score` decimal(10,2) unsigned DEFAULT NULL COMMENT 'Total score amount.', - `create_at` datetime DEFAULT NULL COMMENT 'Created Time', - `update_at` datetime DEFAULT NULL COMMENT 'Updated Time', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2746/issue_2746.go b/server/internal/library/hggen/internal/cmd/testdata/issue/2746/issue_2746.go deleted file mode 100644 index af2b98c..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2746/issue_2746.go +++ /dev/null @@ -1,18 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package entity - -import ( - "github.com/gogf/gf/v2/encoding/gjson" -) - -// Issue2746 is the golang structure for table issue2746. -type Issue2746 struct { - Id uint `json:"ID" orm:"id" ` // User ID - Nickname string `json:"NICKNAME" orm:"nickname" ` // User Nickname - Tag *gjson.Json `json:"TAG" orm:"tag" ` // - Info string `json:"INFO" orm:"info" ` // - Tag2 *gjson.Json `json:"TAG_2" orm:"tag2" ` // Tag2 -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/2746/sql.sql b/server/internal/library/hggen/internal/cmd/testdata/issue/2746/sql.sql deleted file mode 100644 index 99357a1..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/2746/sql.sql +++ /dev/null @@ -1,9 +0,0 @@ -CREATE TABLE %s ( - `id` int unsigned NOT NULL AUTO_INCREMENT COMMENT 'User ID', - `nickname` varchar(45) NOT NULL COMMENT 'User Nickname', - `tag` json NOT NULL, - `info` longtext DEFAULT NULL, - `tag2` json COMMENT 'Tag2', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/3459/config.yaml b/server/internal/library/hggen/internal/cmd/testdata/issue/3459/config.yaml deleted file mode 100644 index ae62cf6..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/3459/config.yaml +++ /dev/null @@ -1,5 +0,0 @@ -gfcli: - gen: - dao: - - link: "pgsql:postgres:postgres@tcp(127.0.0.1:5432)/postgres" - tablesEx: "ex_table1,ex_table2" \ No newline at end of file diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/hello.go b/server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/hello.go deleted file mode 100644 index c1b3b8b..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/hello.go +++ /dev/null @@ -1,26 +0,0 @@ -// ================================================================================= -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ================================================================================= - -package hello - -import ( - "context" - - "hotgo/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v1" - "hotgo/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v2" -) - -type IHelloV1 interface { - DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) - DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error) - DictTypeEditPage(ctx context.Context, req *v1.DictTypeEditPageReq) (res *v1.DictTypeEditPageRes, err error) - DictTypeEdit(ctx context.Context, req *v1.DictTypeEditReq) (res *v1.DictTypeEditRes, err error) -} - -type IHelloV2 interface { - DictTypeAddPage(ctx context.Context, req *v2.DictTypeAddPageReq) (res *v2.DictTypeAddPageRes, err error) - DictTypeAdd(ctx context.Context, req *v2.DictTypeAddReq) (res *v2.DictTypeAddRes, err error) - DictTypeEditPage(ctx context.Context, req *v2.DictTypeEditPageReq) (res *v2.DictTypeEditPageRes, err error) - DictTypeEdit(ctx context.Context, req *v2.DictTypeEditReq) (res *v2.DictTypeEditRes, err error) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v1/req.go b/server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v1/req.go deleted file mode 100644 index 33c2795..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v1/req.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package v1 - -import "github.com/gogf/gf/v2/frame/g" - -type DictTypeAddPageReq struct { - g.Meta `path:"/dict/type/add" tags:"字典管理" method:"get" summary:"字典类型添加页面"` -} - -type DictTypeAddPageRes struct { - g.Meta `mime:"text/html" type:"string" example:""` -} - -type DictTypeAddReq struct { - g.Meta `path:"/dict/type/add" tags:"字典管理" method:"post" summary:"添加字典类型"` -} -type DictTypeAddRes struct { -} - -type DictTypeEditPageReq struct { - g.Meta `path:"/dict/type/edit" tags:"字典管理" method:"get" summary:"字典类型添加页面"` -} - -type DictTypeEditPageRes struct { - g.Meta `mime:"text/html" type:"string" example:""` -} - -type DictTypeEditReq struct { - g.Meta `path:"/dict/type/edit" tags:"字典管理" method:"put" summary:"修改字典类型"` -} -type DictTypeEditRes struct { -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v2/req.go b/server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v2/req.go deleted file mode 100644 index 2764c53..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v2/req.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright GoFrame Author(https://goframe.org). All Rights Reserved. -// -// This Source Code Form is subject to the terms of the MIT License. -// If a copy of the MIT was not distributed with this file, -// You can obtain one at https://github.com/gogf/gf. - -package v2 - -import "github.com/gogf/gf/v2/frame/g" - -type DictTypeAddPageReq struct { - g.Meta `path:"/dict/type/add" tags:"字典管理" method:"get" summary:"字典类型添加页面"` -} - -type DictTypeAddPageRes struct { - g.Meta `mime:"text/html" type:"string" example:""` -} - -type DictTypeAddReq struct { - g.Meta `path:"/dict/type/add" tags:"字典管理" method:"post" summary:"添加字典类型"` -} -type DictTypeAddRes struct { -} - -type DictTypeEditPageReq struct { - g.Meta `path:"/dict/type/edit" tags:"字典管理" method:"get" summary:"字典类型添加页面"` -} - -type DictTypeEditPageRes struct { - g.Meta `mime:"text/html" type:"string" example:""` -} - -type DictTypeEditReq struct { - g.Meta `path:"/dict/type/edit" tags:"字典管理" method:"put" summary:"修改字典类型"` -} -type DictTypeEditRes struct { -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello.go b/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello.go deleted file mode 100644 index f72082f..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello.go +++ /dev/null @@ -1,5 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package hello diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go b/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go deleted file mode 100644 index cdc9864..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_new.go +++ /dev/null @@ -1,21 +0,0 @@ -// ================================================================================= -// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish. -// ================================================================================= - -package hello - -import ( - "hotgo/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello" -) - -type ControllerV1 struct{} - -func NewV1() hello.IHelloV1 { - return &ControllerV1{} -} - -type ControllerV2 struct{} - -func NewV2() hello.IHelloV2 { - return &ControllerV2{} -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_v1_req.go b/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_v1_req.go deleted file mode 100644 index 53fcfef..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_v1_req.go +++ /dev/null @@ -1,23 +0,0 @@ -package hello - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v1" -) - -func (c *ControllerV1) DictTypeAddPage(ctx context.Context, req *v1.DictTypeAddPageReq) (res *v1.DictTypeAddPageRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} -func (c *ControllerV1) DictTypeAdd(ctx context.Context, req *v1.DictTypeAddReq) (res *v1.DictTypeAddRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} -func (c *ControllerV1) DictTypeEditPage(ctx context.Context, req *v1.DictTypeEditPageReq) (res *v1.DictTypeEditPageRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} -func (c *ControllerV1) DictTypeEdit(ctx context.Context, req *v1.DictTypeEditReq) (res *v1.DictTypeEditRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_v2_req.go b/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_v2_req.go deleted file mode 100644 index 7d6d02a..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/3460/controller/hello/hello_v2_req.go +++ /dev/null @@ -1,23 +0,0 @@ -package hello - -import ( - "context" - - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - - "hotgo/internal/library/hggen/internal/cmd/testdata/issue/3460/api/hello/v2" -) - -func (c *ControllerV2) DictTypeAddPage(ctx context.Context, req *v2.DictTypeAddPageReq) (res *v2.DictTypeAddPageRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} -func (c *ControllerV2) DictTypeAdd(ctx context.Context, req *v2.DictTypeAddReq) (res *v2.DictTypeAddRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} -func (c *ControllerV2) DictTypeEditPage(ctx context.Context, req *v2.DictTypeEditPageReq) (res *v2.DictTypeEditPageRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} -func (c *ControllerV2) DictTypeEdit(ctx context.Context, req *v2.DictTypeEditReq) (res *v2.DictTypeEditRes, err error) { - return nil, gerror.NewCode(gcode.CodeNotImplemented) -} diff --git a/server/internal/library/hggen/internal/cmd/testdata/issue/3545/table_user.proto b/server/internal/library/hggen/internal/cmd/testdata/issue/3545/table_user.proto deleted file mode 100644 index 28cf62e..0000000 --- a/server/internal/library/hggen/internal/cmd/testdata/issue/3545/table_user.proto +++ /dev/null @@ -1,21 +0,0 @@ -// ========================================================================== -// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT. -// ========================================================================== - -syntax = "proto3"; - -package pbentity; - -option go_package = "hotgo/internal/library/hggen/internal/cmd/api/pbentity"; - -import "google/protobuf/timestamp.proto"; - -message TableUser { - uint32 Id = 1; // User ID - string Passport = 2; // User Passport - string Password = 3; // User Password - string Nickname = 4; // User Nickname - string Score = 5; // Total score amount. - google.protobuf.Timestamp CreateAt = 6; // Created Time - google.protobuf.Timestamp UpdateAt = 7; // Updated Time -} \ No newline at end of file diff --git a/server/internal/library/hggen/views/curd_generate_web_model.go b/server/internal/library/hggen/views/curd_generate_web_model.go index b4d596f..4fe14f2 100644 --- a/server/internal/library/hggen/views/curd_generate_web_model.go +++ b/server/internal/library/hggen/views/curd_generate_web_model.go @@ -409,26 +409,20 @@ func (l *gCurd) generateWebModelColumnsEach(buffer *bytes.Buffer, in *CurdPrevie in.options.Step.ImportModel.UtilsIs = append(in.options.Step.ImportModel.UtilsIs, "isNullObject") case FormModeUploadImage: - component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return h(%s, {\n width: 32,\n height: 32,\n src: row.%s,\n fallbackSrc: fallbackSrc(),\n onError: errorImg,\n style: {\n width: '32px',\n height: '32px',\n 'max-width': '100%%',\n 'max-height': '100%%',\n },\n });\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, "NImage", field.TsName) - in.options.Step.ImportModel.NaiveUI = append(in.options.Step.ImportModel.NaiveUI, "NImage") - in.options.Step.ImportModel.UtilsHotGo = append(in.options.Step.ImportModel.UtilsHotGo, "fallbackSrc") + component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return renderImage(row.%v);\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName) + in.options.Step.ImportModel.UtilsIndex = append(in.options.Step.ImportModel.UtilsIndex, "renderImage") case FormModeUploadImages: - component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n if (isNullObject(row.%s)) {\n return ``;\n }\n return row.%s.map((image) => {\n return h(%s, {\n width: 32,\n height: 32,\n src: image,\n onError: errorImg,\n style: {\n width: '32px',\n height: '32px',\n 'max-width': '100%%',\n 'max-height': '100%%',\n 'margin-left': '2px',\n },\n });\n });\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName, field.TsName, "NImage") - in.options.Step.ImportModel.NaiveUI = append(in.options.Step.ImportModel.NaiveUI, "NImage") - in.options.Step.ImportModel.UtilsIs = append(in.options.Step.ImportModel.UtilsIs, "isArray") - in.options.Step.ImportModel.UtilsHotGo = append(in.options.Step.ImportModel.UtilsHotGo, "errorImg") + component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return renderImageGroup(row.%v);\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName) + in.options.Step.ImportModel.UtilsIndex = append(in.options.Step.ImportModel.UtilsIndex, "renderImageGroup") case FormModeUploadFile: - component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n if (row.%s === '') {\n return ``;\n }\n return h(\n %s,\n {\n size: 'small',\n },\n {\n default: () => getFileExt(row.%s),\n }\n );\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName, "NAvatar", field.TsName) - in.options.Step.ImportModel.NaiveUI = append(in.options.Step.ImportModel.NaiveUI, "NAvatar") - in.options.Step.ImportModel.UtilsUrl = append(in.options.Step.ImportModel.UtilsUrl, "getFileExt") + component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return renderFile(row.%v);\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName) + in.options.Step.ImportModel.UtilsIndex = append(in.options.Step.ImportModel.UtilsIndex, "renderFile") case FormModeUploadFiles: - component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n if (isNullObject(row.%s)) {\n return ``;\n }\n return row.%s.map((attachfile) => {\n return h(\n %s,\n {\n size: 'small',\n style: {\n 'margin-left': '2px',\n },\n },\n {\n default: () => getFileExt(attachfile),\n }\n );\n });\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName, field.TsName, "NAvatar") - in.options.Step.ImportModel.NaiveUI = append(in.options.Step.ImportModel.NaiveUI, "NAvatar") - in.options.Step.ImportModel.UtilsIs = append(in.options.Step.ImportModel.UtilsIs, "isNullObject") - in.options.Step.ImportModel.UtilsUrl = append(in.options.Step.ImportModel.UtilsUrl, "getFileExt") + component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return renderFileGroup(row.%v);\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, field.TsName) + in.options.Step.ImportModel.UtilsIndex = append(in.options.Step.ImportModel.UtilsIndex, "renderFileGroup") case FormModeSwitch: component = fmt.Sprintf(" {\n title: '%s',\n key: '%s',\n align: '%v',\n width: %v,\n render(row: State) {\n return h(%s, {\n value: row.%s === 1,\n checked: '开启',\n unchecked: '关闭',\n disabled: !hasPermission(['%s']),\n onUpdateValue: function (e) {\n console.log('onUpdateValue e:' + JSON.stringify(e));\n row.%s = e ? 1 : 2;\n Switch({ %s: row.%s, key: '%s', value: row.%s }).then((_res) => {\n $message.success('操作成功');\n });\n },\n });\n },\n },\n", field.Dc, field.TsName, field.Align, field.Width, "NSwitch", field.TsName, "/"+in.options.ApiPrefix+"/switch", field.TsName, in.pk.TsName, in.pk.TsName, convert.CamelCaseToUnderline(field.TsName), field.TsName) diff --git a/server/internal/logic/sys/curd_demo.go b/server/internal/logic/sys/curd_demo.go index b661779..74467a2 100644 --- a/server/internal/logic/sys/curd_demo.go +++ b/server/internal/logic/sys/curd_demo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package sys import ( @@ -224,4 +224,4 @@ func (s *sSysCurdDemo) Switch(ctx context.Context, in *sysin.CurdDemoSwitchInp) return } return -} \ No newline at end of file +} diff --git a/server/internal/logic/sys/normal_tree_demo.go b/server/internal/logic/sys/normal_tree_demo.go index 3fa4674..b5772c8 100644 --- a/server/internal/logic/sys/normal_tree_demo.go +++ b/server/internal/logic/sys/normal_tree_demo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package sys import ( @@ -173,4 +173,4 @@ func (s *sSysNormalTreeDemo) TreeOption(ctx context.Context) (nodes []tree.Node, nodes[i] = v } return tree.ListToTree(0, nodes) -} \ No newline at end of file +} diff --git a/server/internal/logic/sys/option_tree_demo.go b/server/internal/logic/sys/option_tree_demo.go index 9f50ab0..78e0e24 100644 --- a/server/internal/logic/sys/option_tree_demo.go +++ b/server/internal/logic/sys/option_tree_demo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package sys import ( @@ -173,4 +173,4 @@ func (s *sSysOptionTreeDemo) TreeOption(ctx context.Context) (nodes []tree.Node, nodes[i] = v } return tree.ListToTree(0, nodes) -} \ No newline at end of file +} diff --git a/server/internal/model/input/sysin/curd_demo.go b/server/internal/model/input/sysin/curd_demo.go index c7eb8ff..5565dec 100644 --- a/server/internal/model/input/sysin/curd_demo.go +++ b/server/internal/model/input/sysin/curd_demo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package sysin import ( @@ -197,4 +197,4 @@ func (in *CurdDemoSwitchInp) Filter(ctx context.Context) (err error) { return } -type CurdDemoSwitchModel struct{} \ No newline at end of file +type CurdDemoSwitchModel struct{} diff --git a/server/internal/model/input/sysin/normal_tree_demo.go b/server/internal/model/input/sysin/normal_tree_demo.go index feecac8..dbb21d0 100644 --- a/server/internal/model/input/sysin/normal_tree_demo.go +++ b/server/internal/model/input/sysin/normal_tree_demo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package sysin import ( @@ -21,6 +21,8 @@ import ( type NormalTreeDemoUpdateFields struct { Title string `json:"title" dc:"标题"` Pid int64 `json:"pid" dc:"上级"` + Level int `json:"level" dc:"关系树级别"` + Tree string `json:"tree" dc:"关系树"` CategoryId int64 `json:"categoryId" dc:"测试分类"` Description string `json:"description" dc:"描述"` Sort int `json:"sort" dc:"排序"` @@ -32,6 +34,8 @@ type NormalTreeDemoUpdateFields struct { type NormalTreeDemoInsertFields struct { Title string `json:"title" dc:"标题"` Pid int64 `json:"pid" dc:"上级"` + Level int `json:"level" dc:"关系树级别"` + Tree string `json:"tree" dc:"关系树"` CategoryId int64 `json:"categoryId" dc:"测试分类"` Description string `json:"description" dc:"描述"` Sort int `json:"sort" dc:"排序"` @@ -138,4 +142,4 @@ func (t *NormalTreeDemoTreeOption) PID() int64 { // SetChildren 设置子节点数据 func (t *NormalTreeDemoTreeOption) SetChildren(children []tree.Node) { t.Children = children -} \ No newline at end of file +} diff --git a/server/internal/model/input/sysin/option_tree_demo.go b/server/internal/model/input/sysin/option_tree_demo.go index 40f9254..0c238ed 100644 --- a/server/internal/model/input/sysin/option_tree_demo.go +++ b/server/internal/model/input/sysin/option_tree_demo.go @@ -3,7 +3,7 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package sysin import ( @@ -141,4 +141,4 @@ func (t *OptionTreeDemoTreeOption) PID() int64 { // SetChildren 设置子节点数据 func (t *OptionTreeDemoTreeOption) SetChildren(children []tree.Node) { t.Children = children -} \ No newline at end of file +} diff --git a/server/internal/router/genrouter/curd_demo.go b/server/internal/router/genrouter/curd_demo.go index d259dc1..168b7cf 100644 --- a/server/internal/router/genrouter/curd_demo.go +++ b/server/internal/router/genrouter/curd_demo.go @@ -3,11 +3,11 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package genrouter import "hotgo/internal/controller/admin/sys" func init() { LoginRequiredRouter = append(LoginRequiredRouter, sys.CurdDemo) // CURD列表 -} \ No newline at end of file +} diff --git a/server/internal/router/genrouter/normal_tree_demo.go b/server/internal/router/genrouter/normal_tree_demo.go index 08adb1a..2565f6d 100644 --- a/server/internal/router/genrouter/normal_tree_demo.go +++ b/server/internal/router/genrouter/normal_tree_demo.go @@ -3,11 +3,11 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package genrouter import "hotgo/internal/controller/admin/sys" func init() { LoginRequiredRouter = append(LoginRequiredRouter, sys.NormalTreeDemo) // 普通树表 -} \ No newline at end of file +} diff --git a/server/internal/router/genrouter/option_tree_demo.go b/server/internal/router/genrouter/option_tree_demo.go index 7f995e2..a77b321 100644 --- a/server/internal/router/genrouter/option_tree_demo.go +++ b/server/internal/router/genrouter/option_tree_demo.go @@ -3,11 +3,11 @@ // @Copyright Copyright (c) 2024 HotGo CLI // @Author Ms <133814250@qq.com> // @License https://github.com/bufanyun/hotgo/blob/master/LICENSE -// @AutoGenerate Version 2.15.1 +// @AutoGenerate Version 2.15.7 package genrouter import "hotgo/internal/controller/admin/sys" func init() { LoginRequiredRouter = append(LoginRequiredRouter, sys.OptionTreeDemo) // 选项树表 -} \ No newline at end of file +} diff --git a/server/resource/generate/default/curd/controller.go.template b/server/resource/generate/default/curd/controller.go.template index b76da5a..13cfef7 100644 --- a/server/resource/generate/default/curd/controller.go.template +++ b/server/resource/generate/default/curd/controller.go.template @@ -103,7 +103,16 @@ func (c *c@{.varName}) Switch(ctx context.Context, req *@{.varName | ToLower}.Sw // TreeOption 获取@{.tableComment}关系树选项 func (c *c@{.varName}) TreeOption(ctx context.Context, req *@{.varName | ToLower}.TreeOptionReq) (res *@{.varName | ToLower}.TreeOptionRes, err error) { data, err := service.@{.servFunName}().TreeOption(ctx) - res = (*@{.varName | ToLower}.TreeOptionRes)(&data) + if err != nil { + return nil, err + } + + if len(data) > 0 { + res = (*@{.varName | ToLower}.TreeOptionRes)(&data) + } else { + temp := make(@{.varName | ToLower}.TreeOptionRes, 0) + res = &temp + } return } @{end} diff --git a/web/src/utils/hotgo.ts b/web/src/utils/hotgo.ts index b1e15db..5ad5f6f 100644 --- a/web/src/utils/hotgo.ts +++ b/web/src/utils/hotgo.ts @@ -145,6 +145,9 @@ export function rdmLightRgbColor(): string { // 将列表数据转为树形数据 export function convertListToTree(list: any[], idField = 'id', pidField = 'pid') { + if (!list || list.length === 0) { + return []; + } const min = list.reduce((prev, current) => (prev[pidField] < current[pidField] ? prev : current)); const map = list.reduce((acc, item) => { @@ -154,6 +157,13 @@ export function convertListToTree(list: any[], idField = 'id', pidField = 'pid') list.forEach((item) => { if (item[pidField] !== min[pidField]) { + if (!map[item[pidField]]) { + map[item[pidField]] = {}; + } + + if (!map[item[pidField]].children) { + map[item[pidField]].children = []; + } map[item[pidField]].children.push(map[item[idField]]); } }); @@ -163,6 +173,9 @@ export function convertListToTree(list: any[], idField = 'id', pidField = 'pid') // 从树选项中获取所有key export function getTreeKeys(data: any[], idField = 'id') { const keys: any = []; + if (!data || data.length === 0) { + return keys; + } data.map((item: any) => { keys.push(item[idField]); if (item.children && item.children.length) { diff --git a/web/src/utils/index.ts b/web/src/utils/index.ts index 715f2d4..823f65a 100644 --- a/web/src/utils/index.ts +++ b/web/src/utils/index.ts @@ -5,6 +5,7 @@ import { NBadge, NButton, NIcon, + NImage, NPopover, NTable, NTag, @@ -13,10 +14,12 @@ import { } from 'naive-ui'; import { EllipsisHorizontalCircleOutline } from '@vicons/ionicons5'; import { PageEnum } from '@/enums/pageEnum'; -import { isNullObject, isObject } from './is/index'; +import { isArray, isJsonString, isNullObject, isObject } from './is/index'; import { cloneDeep } from 'lodash-es'; import { VNode } from 'vue'; import { DictType, useDictStore } from '@/store/modules/dict'; +import { fallbackSrc } from '@/utils/hotgo'; +import {getFileExt} from "@/utils/urlUtils"; export const renderTooltip = (trigger, content) => { return h(NTooltip, null, { @@ -95,6 +98,71 @@ export const renderOptionTag = (type: DictType, value: any) => { ); }; +// render 图片 +export const renderImage = (image: string) => { + if (!image || image === '') { + return ``; + } + return h(NImage, { + width: 32, + height: 32, + src: image, + fallbackSrc: fallbackSrc(), + style: { + width: '32px', + height: '32px', + 'max-width': '100%', + 'max-height': '100%', + 'margin-left': '2px', + }, + }); +}; + +// render 图片组 +export const renderImageGroup = (images: any) => { + if (isJsonString(images)) { + images = JSON.parse(images); + } + if (isNullObject(images) || !isArray(images)) { + return ``; + } + return images.map((image: string) => { + return renderImage(image); + }); +}; + +// render 文件 +export const renderFile = (file: string) => { + if (!file || file === '') { + return ``; + } + return h( + NAvatar, + { + size: 'small', + style: { + 'margin-left': '2px', + }, + }, + { + default: () => getFileExt(file), + } + ); +}; + +// render 文件组 +export const renderFileGroup = (files: any) => { + if (isJsonString(files)) { + files = JSON.parse(files); + } + if (isNullObject(files) || !isArray(files)) { + return ``; + } + return files.map((file: string) => { + return renderFile(file); + }); +}; + export interface MemberSumma { id: number; // 用户ID realName: string; // 真实姓名 @@ -103,7 +171,7 @@ export interface MemberSumma { } // render 操作人摘要 -export const renderPopoverMemberSumma = (member?: MemberSumma) => { +export const renderPopoverMemberSumma = (member: MemberSumma | null | undefined) => { if (!member) { return ''; } diff --git a/web/src/utils/is/index.ts b/web/src/utils/is/index.ts index cb1c46b..f4fa400 100644 --- a/web/src/utils/is/index.ts +++ b/web/src/utils/is/index.ts @@ -100,8 +100,13 @@ export function isJsonString(value: any) { return false; } -export function isNullObject(value: object) { - return isNullOrUnDef(value) || JSON.stringify(value) === '{}' || JSON.stringify(value) === '[]'; +export function isNullObject(value: any) { + return ( + isNullOrUnDef(value) || + JSON.stringify(value) === '{}' || + JSON.stringify(value) === '[]' || + value === '' + ); } /** diff --git a/web/src/views/curdDemo/edit.vue b/web/src/views/curdDemo/edit.vue index 5c5f4cf..5d31ce8 100644 --- a/web/src/views/curdDemo/edit.vue +++ b/web/src/views/curdDemo/edit.vue @@ -107,6 +107,34 @@ return adaModalWidth(840); }); + // 提交表单 + function confirmForm(e) { + e.preventDefault(); + formRef.value.validate((errors) => { + if (!errors) { + formBtnLoading.value = true; + Edit(formValue.value) + .then((_res) => { + message.success('操作成功'); + closeForm(); + emit('reloadTable'); + }) + .finally(() => { + formBtnLoading.value = false; + }); + } else { + message.error('请填写完整信息'); + } + }); + } + + // 关闭表单 + function closeForm() { + showModal.value = false; + loading.value = false; + } + + // 打开模态框 function openModal(state: State) { showModal.value = true; @@ -136,33 +164,6 @@ }); } - // 提交表单 - function confirmForm(e) { - e.preventDefault(); - formRef.value.validate((errors) => { - if (!errors) { - formBtnLoading.value = true; - Edit(formValue.value) - .then((_res) => { - message.success('操作成功'); - closeForm(); - emit('reloadTable'); - }) - .finally(() => { - formBtnLoading.value = false; - }); - } else { - message.error('请填写完整信息'); - } - }); - } - - // 关闭表单 - function closeForm() { - showModal.value = false; - loading.value = false; - } - defineExpose({ openModal, }); diff --git a/web/src/views/curdDemo/index.vue b/web/src/views/curdDemo/index.vue index a49db27..54209ff 100644 --- a/web/src/views/curdDemo/index.vue +++ b/web/src/views/curdDemo/index.vue @@ -57,10 +57,10 @@ import { adaTableScrollX } from '@/utils/hotgo'; import Edit from './edit.vue'; + const dict = useDictStore(); const dialog = useDialog(); const message = useMessage(); const { hasPermission } = usePermission(); - const dict = useDictStore(); const actionRef = ref(); const searchFormRef = ref({}); const editRef = ref(); @@ -72,7 +72,7 @@ title: '操作', key: 'action', fixed: 'right', - render(record) { + render(record: State) { return h(TableAction as any, { style: 'button', actions: [ diff --git a/web/src/views/curdDemo/model.ts b/web/src/views/curdDemo/model.ts index 1ef663d..df3100e 100644 --- a/web/src/views/curdDemo/model.ts +++ b/web/src/views/curdDemo/model.ts @@ -1,11 +1,9 @@ import { h, ref } from 'vue'; -import { NImage, NAvatar, NSwitch } from 'naive-ui'; +import { NSwitch } from 'naive-ui'; import { cloneDeep } from 'lodash-es'; import { FormSchema } from '@/components/Form'; -import { getFileExt } from '@/utils/urlUtils'; import { defRangeShortcuts } from '@/utils/dateUtil'; -import { fallbackSrc } from '@/utils/hotgo'; -import { renderPopoverMemberSumma, MemberSumma } from '@/utils'; +import { renderImage, renderFile, renderPopoverMemberSumma, MemberSumma } from '@/utils'; import { Switch } from '@/api/curdDemo'; import { useDictStore } from '@/store/modules/dict'; import { usePermission } from '@/hooks/web/usePermission'; @@ -176,19 +174,8 @@ export const columns = [ key: 'image', align: 'left', width: 100, - render(row) { - return h(NImage, { - width: 32, - height: 32, - src: row.image, - fallbackSrc: fallbackSrc(), - style: { - width: '32px', - height: '32px', - 'max-width': '100%', - 'max-height': '100%', - }, - }); + render(row: State) { + return renderImage(row.image); }, }, { @@ -196,19 +183,8 @@ export const columns = [ key: 'attachfile', align: 'left', width: 100, - render(row) { - if (row.attachfile === '') { - return ``; - } - return h( - NAvatar, - { - size: 'small', - }, - { - default: () => getFileExt(row.attachfile), - } - ); + render(row: State) { + return renderFile(row.attachfile); }, }, { @@ -222,7 +198,7 @@ export const columns = [ key: 'switch', align: 'left', width: 150, - render(row) { + render(row: State) { return h(NSwitch, { value: row.switch === 1, checked: '开启', @@ -243,7 +219,7 @@ export const columns = [ key: 'createdBy', align: 'left', width: 150, - render(row) { + render(row: State) { return renderPopoverMemberSumma(row.createdBySumma); }, }, @@ -258,7 +234,7 @@ export const columns = [ key: 'updatedBy', align: 'left', width: 150, - render(row) { + render(row: State) { return renderPopoverMemberSumma(row.updatedBySumma); }, }, @@ -279,4 +255,4 @@ export const columns = [ // 加载字典数据选项 export function loadOptions() { dict.loadOptions(['sys_normal_disable', 'testCategoryOption']); -} +} \ No newline at end of file diff --git a/web/src/views/normalTreeDemo/edit.vue b/web/src/views/normalTreeDemo/edit.vue index 8608f5a..712cc71 100644 --- a/web/src/views/normalTreeDemo/edit.vue +++ b/web/src/views/normalTreeDemo/edit.vue @@ -101,6 +101,34 @@ return adaModalWidth(840); }); + // 提交表单 + function confirmForm(e) { + e.preventDefault(); + formRef.value.validate((errors) => { + if (!errors) { + formBtnLoading.value = true; + Edit(formValue.value) + .then((_res) => { + message.success('操作成功'); + closeForm(); + emit('reloadTable'); + }) + .finally(() => { + formBtnLoading.value = false; + }); + } else { + message.error('请填写完整信息'); + } + }); + } + + // 关闭表单 + function closeForm() { + showModal.value = false; + loading.value = false; + } + + // 打开模态框 function openModal(state: State) { showModal.value = true; @@ -133,33 +161,6 @@ }); } - // 提交表单 - function confirmForm(e) { - e.preventDefault(); - formRef.value.validate((errors) => { - if (!errors) { - formBtnLoading.value = true; - Edit(formValue.value) - .then((_res) => { - message.success('操作成功'); - closeForm(); - emit('reloadTable'); - }) - .finally(() => { - formBtnLoading.value = false; - }); - } else { - message.error('请填写完整信息'); - } - }); - } - - // 关闭表单 - function closeForm() { - showModal.value = false; - loading.value = false; - } - defineExpose({ openModal, }); diff --git a/web/src/views/normalTreeDemo/index.vue b/web/src/views/normalTreeDemo/index.vue index f21e392..c964ba4 100644 --- a/web/src/views/normalTreeDemo/index.vue +++ b/web/src/views/normalTreeDemo/index.vue @@ -59,13 +59,13 @@ import { adaTableScrollX, convertListToTree } from '@/utils/hotgo'; import Edit from './edit.vue'; + const dict = useDictStore(); const dialog = useDialog(); const message = useMessage(); const { hasPermission } = usePermission(); const actionRef = ref(); const searchFormRef = ref({}); const editRef = ref(); - const dict = useDictStore(); const checkedIds = ref([]); const expandedKeys = ref([]); @@ -76,7 +76,7 @@ title: '操作', key: 'action', fixed: 'right', - render(record) { + render(record: State) { return h(TableAction as any, { style: 'button', actions: [ diff --git a/web/src/views/normalTreeDemo/model.ts b/web/src/views/normalTreeDemo/model.ts index 1b0ef97..361d809 100644 --- a/web/src/views/normalTreeDemo/model.ts +++ b/web/src/views/normalTreeDemo/model.ts @@ -1,10 +1,8 @@ import { h, ref } from 'vue'; -import { NTag } from 'naive-ui'; import { cloneDeep } from 'lodash-es'; import { FormSchema } from '@/components/Form'; -import { isNullObject } from '@/utils/is'; import { defRangeShortcuts } from '@/utils/dateUtil'; -import { renderPopoverMemberSumma, MemberSumma } from '@/utils'; +import { renderOptionTag, renderPopoverMemberSumma, MemberSumma } from '@/utils'; import { TreeOption } from '@/api/normalTreeDemo'; import { useDictStore } from '@/store/modules/dict'; @@ -121,23 +119,8 @@ export const columns = [ key: 'categoryId', align: 'left', width: 100, - render(row) { - if (isNullObject(row.categoryId)) { - return ``; - } - return h( - NTag, - { - style: { - marginRight: '6px', - }, - type: dict.getType('testCategoryOption', row.categoryId), - bordered: false, - }, - { - default: () => dict.getLabel('testCategoryOption', row.categoryId), - } - ); + render(row: State) { + return renderOptionTag('testCategoryOption', row.categoryId); }, }, { @@ -151,23 +134,8 @@ export const columns = [ key: 'status', align: 'left', width: 150, - render(row) { - if (isNullObject(row.status)) { - return ``; - } - return h( - NTag, - { - style: { - marginRight: '6px', - }, - type: dict.getType('sys_normal_disable', row.status), - bordered: false, - }, - { - default: () => dict.getLabel('sys_normal_disable', row.status), - } - ); + render(row: State) { + return renderOptionTag('sys_normal_disable', row.status); }, }, { @@ -175,7 +143,7 @@ export const columns = [ key: 'createdBy', align: 'left', width: 100, - render(row) { + render(row: State) { return renderPopoverMemberSumma(row.createdBySumma); }, },