Skip to content

Commit b6146d7

Browse files
奇淼(piexlmaxbypanghu陶正虎krank666
authored
* fix:优化自动化代码搜索区域 (flipped-aurora#1382) * 增加gpt功能(万用表格) * feat: chatTable页面 --------- Co-authored-by: ipanghu <bypanghu@163.com> Co-authored-by: 陶正虎 <zhenghu.tao@jutze.com.cn> Co-authored-by: krank <emosick@qq.com>
1 parent 1aea415 commit b6146d7

File tree

24 files changed

+473
-56
lines changed

24 files changed

+473
-56
lines changed

server/api/v1/system/enter.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type ApiGroup struct {
1717
AutoCodeHistoryApi
1818
DictionaryDetailApi
1919
AuthorityBtnApi
20+
ChatGptApi
2021
}
2122

2223
var (
@@ -35,4 +36,5 @@ var (
3536
autoCodeHistoryService = service.ServiceGroupApp.SystemServiceGroup.AutoCodeHistoryService
3637
dictionaryDetailService = service.ServiceGroupApp.SystemServiceGroup.DictionaryDetailService
3738
authorityBtnService = service.ServiceGroupApp.SystemServiceGroup.AuthorityBtnService
39+
chatGptService = service.ServiceGroupApp.SystemServiceGroup.ChatGptService
3840
)

server/api/v1/system/sys_chatgpt.go

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
package system
2+
3+
import (
4+
"github.com/flipped-aurora/gin-vue-admin/server/global"
5+
"github.com/flipped-aurora/gin-vue-admin/server/model/common/response"
6+
sysModel "github.com/flipped-aurora/gin-vue-admin/server/model/system"
7+
"github.com/flipped-aurora/gin-vue-admin/server/model/system/request"
8+
"github.com/gin-gonic/gin"
9+
"go.uber.org/zap"
10+
)
11+
12+
type ChatGptApi struct{}
13+
14+
func (chat *ChatGptApi) CreateSK(c *gin.Context) {
15+
var option sysModel.SysChatGptOption
16+
c.ShouldBindJSON(&option)
17+
err := chatGptService.CreateSK(option)
18+
if err != nil {
19+
global.GVA_LOG.Error("创建失败!", zap.Error(err))
20+
response.FailWithMessage("创建失败"+err.Error(), c)
21+
return
22+
}
23+
response.OkWithMessage("创建成功", c)
24+
}
25+
26+
func (chat *ChatGptApi) GetSK(c *gin.Context) {
27+
var option sysModel.SysChatGptOption
28+
c.ShouldBindJSON(&option)
29+
_, err := chatGptService.GetSK()
30+
if err != nil {
31+
response.OkWithDetailed(gin.H{
32+
"ok": false,
33+
}, "无sk或获取失败", c)
34+
return
35+
}
36+
response.OkWithDetailed(gin.H{
37+
"ok": true,
38+
}, "获取成功", c)
39+
}
40+
41+
func (chat *ChatGptApi) DeleteSK(c *gin.Context) {
42+
err := chatGptService.DeleteSK()
43+
if err != nil {
44+
global.GVA_LOG.Error("删除失败!", zap.Error(err))
45+
response.FailWithMessage("删除失败"+err.Error(), c)
46+
return
47+
}
48+
response.OkWithMessage("删除成功", c)
49+
}
50+
51+
func (chat *ChatGptApi) GetTable(c *gin.Context) {
52+
var req request.ChatGptRequest
53+
err := c.ShouldBindJSON(&req)
54+
if err != nil {
55+
response.FailWithMessage(err.Error(), c)
56+
return
57+
}
58+
sql, results, err := chatGptService.GetTable(req)
59+
if err != nil {
60+
global.GVA_LOG.Error("查询失败!", zap.Error(err))
61+
response.FailWithDetailed(gin.H{
62+
"sql": sql,
63+
"results": results,
64+
}, "生成失败"+err.Error(), c)
65+
return
66+
}
67+
response.OkWithDetailed(gin.H{
68+
"sql": sql,
69+
"results": results,
70+
}, "ChatGpt生成完成", c)
71+
}

server/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,4 +223,4 @@ cors:
223223
allow-headers: content-type
224224
allow-methods: GET, POST
225225
expose-headers: Content-Length, Access-Control-Allow-Origin, Access-Control-Allow-Headers, Content-Type
226-
allow-credentials: true # 布尔值
226+
allow-credentials: true # 布尔值

server/go.mod

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ require (
2424
github.com/pkg/errors v0.9.1
2525
github.com/qiniu/api.v7/v7 v7.4.1
2626
github.com/robfig/cron/v3 v3.0.1
27+
github.com/sashabaranov/go-openai v1.5.7
2728
github.com/satori/go.uuid v1.2.0
2829
github.com/shirou/gopsutil/v3 v3.22.5
2930
github.com/songzhibin97/gkit v1.2.7
@@ -95,14 +96,11 @@ require (
9596
github.com/mitchellh/mapstructure v1.2.2 // indirect
9697
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
9798
github.com/modern-go/reflect2 v1.0.2 // indirect
98-
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
9999
github.com/mozillazg/go-httpheader v0.2.1 // indirect
100100
github.com/pelletier/go-toml v1.6.0 // indirect
101101
github.com/pmezard/go-difflib v1.0.0 // indirect
102102
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
103103
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
104-
github.com/richardlehane/mscfb v1.0.3 // indirect
105-
github.com/richardlehane/msoleps v1.0.1 // indirect
106104
github.com/spf13/afero v1.2.2 // indirect
107105
github.com/spf13/cast v1.3.1 // indirect
108106
github.com/spf13/jwalterweatherman v1.1.0 // indirect
@@ -111,7 +109,6 @@ require (
111109
github.com/tklauser/go-sysconf v0.3.10 // indirect
112110
github.com/tklauser/numcpus v0.4.0 // indirect
113111
github.com/ugorji/go/codec v1.2.6 // indirect
114-
github.com/xuri/efp v0.0.0-20210322160811-ab561f5b45e3 // indirect
115112
github.com/yusufpapurcu/wmi v1.2.2 // indirect
116113
go.uber.org/atomic v1.6.0 // indirect
117114
go.uber.org/multierr v1.5.0 // indirect

server/go.sum

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -393,8 +393,6 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
393393
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
394394
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
395395
github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8=
396-
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9M+97sNutRR1RKhG96O6jWumTTnw=
397-
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
398396
github.com/mojocn/base64Captcha v1.3.1 h1:2Wbkt8Oc8qjmNJ5GyOfSo4tgVQPsbKMftqASnq8GlT0=
399397
github.com/mojocn/base64Captcha v1.3.1/go.mod h1:wAQCKEc5bDujxKRmbT6/vTnTt5CjStQ8bRfPWUuz/iY=
400398
github.com/mozillazg/go-httpheader v0.2.1 h1:geV7TrjbL8KXSyvghnFm+NyTux/hxwueTSrwhe88TQQ=
@@ -448,10 +446,6 @@ github.com/qiniu/api.v7/v7 v7.4.1 h1:BnNUBimLk6nrA/mIwsww9yJRupmViSsb1ndLMC7a9OY
448446
github.com/qiniu/api.v7/v7 v7.4.1/go.mod h1:VE5oC5rkE1xul0u1S2N0b2Uxq9/6hZzhyqjgK25XDcM=
449447
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
450448
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
451-
github.com/richardlehane/mscfb v1.0.3 h1:rD8TBkYWkObWO0oLDFCbwMeZ4KoalxQy+QgniCj3nKI=
452-
github.com/richardlehane/mscfb v1.0.3/go.mod h1:YzVpcZg9czvAuhk9T+a3avCpcFPMUWm7gK3DypaEsUk=
453-
github.com/richardlehane/msoleps v1.0.1 h1:RfrALnSNXzmXLbGct/P2b4xkFz4e8Gmj/0Vj9M9xC1o=
454-
github.com/richardlehane/msoleps v1.0.1/go.mod h1:BWev5JBpU9Ko2WAgmZEuiz4/u3ZYTKbjLycmwiWUfWg=
455449
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
456450
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
457451
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
@@ -464,6 +458,8 @@ github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OK
464458
github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
465459
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
466460
github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
461+
github.com/sashabaranov/go-openai v1.5.7 h1:8DGgRG+P7yWixte5j720y6yiXgY3Hlgcd0gcpHdltfo=
462+
github.com/sashabaranov/go-openai v1.5.7/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg=
467463
github.com/satori/go.uuid v1.2.0 h1:0uYX9dsZ2yD7q2RtLRtPSdGDWzjeM3TbMJP9utgA0ww=
468464
github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
469465
github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
@@ -538,10 +534,6 @@ github.com/unrolled/secure v1.0.7/go.mod h1:uGc1OcRF8gCVBA+ANksKmvM85Hka6SZtQIbr
538534
github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
539535
github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI=
540536
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
541-
github.com/xuri/efp v0.0.0-20210322160811-ab561f5b45e3 h1:EpI0bqf/eX9SdZDwlMmahKM+CDBgNbsXMhsN28XrM8o=
542-
github.com/xuri/efp v0.0.0-20210322160811-ab561f5b45e3/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
543-
github.com/xuri/excelize/v2 v2.4.1 h1:veeeFLAJwsNEBPBlDepzPIYS1eLyBVcXNZUW79exZ1E=
544-
github.com/xuri/excelize/v2 v2.4.1/go.mod h1:rSu0C3papjzxQA3sdK8cU544TebhrPUoTOaGPIh0Q1A=
545537
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
546538
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
547539
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
@@ -634,7 +626,6 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
634626
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
635627
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
636628
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
637-
golang.org/x/net v0.0.0-20210726213435-c6fcb2dbf985/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
638629
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
639630
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f h1:hEYJvxw1lSnWIl8X9ofsYMklzaDs90JI2az5YMd4fPM=
640631
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
@@ -966,7 +957,6 @@ modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw
966957
modernc.org/tcl v1.11.2/go.mod h1:BRzgpajcGdS2qTxniOx9c/dcxjlbA7p12eJNmiriQYo=
967958
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
968959
modernc.org/z v1.3.2/go.mod h1:PEU2oK2OEA1CfzDTd+8E908qEXhC9s0MfyKp5LZsd+k=
969-
nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k=
970960
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
971961
nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g=
972962
nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=

server/initialize/gorm.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func RegisterTables() {
4747
system.SysBaseMenuBtn{},
4848
system.SysAuthorityBtn{},
4949
system.SysAutoCode{},
50+
system.SysChatGptOption{},
5051

5152
example.ExaFile{},
5253
example.ExaCustomer{},

server/initialize/router.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func Routers() *gin.Engine {
6666
systemRouter.InitSysOperationRecordRouter(PrivateGroup) // 操作记录
6767
systemRouter.InitSysDictionaryDetailRouter(PrivateGroup) // 字典详情管理
6868
systemRouter.InitAuthorityBtnRouterRouter(PrivateGroup) // 字典详情管理
69+
systemRouter.InitChatGptRouter(PrivateGroup) // chatGpt接口
6970

7071
exampleRouter.InitCustomerRouter(PrivateGroup) // 客户路由
7172
exampleRouter.InitFileUploadAndDownloadRouter(PrivateGroup) // 文件上传下载功能路由
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package request
2+
3+
import (
4+
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request"
5+
"github.com/flipped-aurora/gin-vue-admin/server/model/system"
6+
)
7+
8+
type ChatGptRequest struct {
9+
system.ChatGpt
10+
request.PageInfo
11+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package response
2+
3+
type ChatGptResponse struct {
4+
}

server/model/system/sys_chatgpt.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package system
2+
3+
type ChatGpt struct {
4+
DBName string `json:"dbname,omitempty"`
5+
Chat string `json:"chat,omitempty"`
6+
ChatID string `json:"chatID,omitempty"`
7+
}
8+
9+
type SysChatGptOption struct {
10+
SK string `json:"sk"`
11+
}
12+
13+
type ChatField struct {
14+
TABLE_NAME string
15+
COLUMN_NAME string
16+
COLUMN_COMMENT string
17+
}
18+
19+
type ChatFieldNoTable struct {
20+
COLUMN_NAME string
21+
COLUMN_COMMENT string
22+
}

server/router/system/enter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ type RouterGroup struct {
1515
OperationRecordRouter
1616
DictionaryDetailRouter
1717
AuthorityBtnRouter
18+
ChatGptRouter
1819
}

server/router/system/sys_chatgpt.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package system
2+
3+
import (
4+
v1 "github.com/flipped-aurora/gin-vue-admin/server/api/v1"
5+
"github.com/flipped-aurora/gin-vue-admin/server/middleware"
6+
"github.com/gin-gonic/gin"
7+
)
8+
9+
type ChatGptRouter struct{}
10+
11+
func (s *ChatGptRouter) InitChatGptRouter(Router *gin.RouterGroup) {
12+
chatGptRouter := Router.Group("chatGpt").Use(middleware.OperationRecord())
13+
chatGptApi := v1.ApiGroupApp.SystemApiGroup.ChatGptApi
14+
{
15+
chatGptRouter.POST("createSK", chatGptApi.CreateSK)
16+
chatGptRouter.GET("getSK", chatGptApi.GetSK)
17+
chatGptRouter.DELETE("deleteSK", chatGptApi.DeleteSK)
18+
chatGptRouter.POST("getTable", chatGptApi.GetTable)
19+
}
20+
}

server/service/system/enter.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ type ServiceGroup struct {
1616
OperationRecordService
1717
DictionaryDetailService
1818
AuthorityBtnService
19+
ChatGptService
1920
}

server/service/system/sys_auto_code.go

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ type AutoCodeService struct{}
123123

124124
var AutoCodeServiceApp = new(AutoCodeService)
125125

126-
//@author: [songzhibin97](https://github.com/songzhibin97)
127-
//@function: PreviewTemp
128-
//@description: 预览创建代码
129-
//@param: model.AutoCodeStruct
130-
//@return: map[string]string, error
126+
// @author: [songzhibin97](https://github.com/songzhibin97)
127+
// @function: PreviewTemp
128+
// @description: 预览创建代码
129+
// @param: model.AutoCodeStruct
130+
// @return: map[string]string, error
131131

132132
func (autoCodeService *AutoCodeService) PreviewTemp(autoCode system.AutoCodeStruct) (map[string]string, error) {
133133
makeDictTypes(&autoCode)
@@ -213,11 +213,11 @@ func makeDictTypes(autoCode *system.AutoCodeStruct) {
213213
}
214214
}
215215

216-
//@author: [piexlmax](https://github.com/piexlmax)
217-
//@function: CreateTemp
218-
//@description: 创建代码
219-
//@param: model.AutoCodeStruct
220-
//@return: err error
216+
// @author: [piexlmax](https://github.com/piexlmax)
217+
// @function: CreateTemp
218+
// @description: 创建代码
219+
// @param: model.AutoCodeStruct
220+
// @return: err error
221221

222222
func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruct, ids ...uint) (err error) {
223223
makeDictTypes(&autoCode)
@@ -291,6 +291,7 @@ func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruc
291291
// 在gorm.go 注入 自动迁移
292292
path := filepath.Join(global.GVA_CONFIG.AutoCode.Root,
293293
global.GVA_CONFIG.AutoCode.Server, global.GVA_CONFIG.AutoCode.SInitialize, "gorm.go")
294+
autoCode.BusinessDB = utils.MaheHump(autoCode.BusinessDB) // 这里将 数据库中间存在 - 的转换为驼峰
294295
ast2.AddRegisterTablesAst(path, "RegisterTables", autoCode.Package, autoCode.BusinessDB, autoCode.StructName)
295296
}
296297

@@ -300,7 +301,7 @@ func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruc
300301
global.GVA_CONFIG.AutoCode.Server, global.GVA_CONFIG.AutoCode.SInitialize, "router.go")
301302
ast2.AddRouterCode(path, "Routers", autoCode.Package, autoCode.StructName)
302303
}
303-
//给各个enter进行注入
304+
// 给各个enter进行注入
304305
err = injectionCode(autoCode.StructName, &injectionCodeMeta)
305306
if err != nil {
306307
return
@@ -351,11 +352,11 @@ func (autoCodeService *AutoCodeService) CreateTemp(autoCode system.AutoCodeStruc
351352
return nil
352353
}
353354

354-
//@author: [piexlmax](https://github.com/piexlmax)
355-
//@function: GetAllTplFile
356-
//@description: 获取 pathName 文件夹下所有 tpl 文件
357-
//@param: pathName string, fileList []string
358-
//@return: []string, error
355+
// @author: [piexlmax](https://github.com/piexlmax)
356+
// @function: GetAllTplFile
357+
// @description: 获取 pathName 文件夹下所有 tpl 文件
358+
// @param: pathName string, fileList []string
359+
// @return: []string, error
359360

360361
func (autoCodeService *AutoCodeService) GetAllTplFile(pathName string, fileList []string) ([]string, error) {
361362
files, err := os.ReadDir(pathName)
@@ -374,11 +375,11 @@ func (autoCodeService *AutoCodeService) GetAllTplFile(pathName string, fileList
374375
return fileList, err
375376
}
376377

377-
//@author: [piexlmax](https://github.com/piexlmax)
378-
//@function: GetDB
379-
//@description: 获取指定数据库和指定数据表的所有字段名,类型值等
380-
//@param: tableName string, dbName string
381-
//@return: err error, Columns []request.ColumnReq
378+
// @author: [piexlmax](https://github.com/piexlmax)
379+
// @function: GetDB
380+
// @description: 获取指定数据库和指定数据表的所有字段名,类型值等
381+
// @param: tableName string, dbName string
382+
// @return: err error, Columns []request.ColumnReq
382383

383384
func (autoCodeService *AutoCodeService) DropTable(BusinessDb, tableName string) error {
384385
if BusinessDb != "" {
@@ -388,12 +389,12 @@ func (autoCodeService *AutoCodeService) DropTable(BusinessDb, tableName string)
388389
}
389390
}
390391

391-
//@author: [SliverHorn](https://github.com/SliverHorn)
392-
//@author: [songzhibin97](https://github.com/songzhibin97)
393-
//@function: addAutoMoveFile
394-
//@description: 生成对应的迁移文件路径
395-
//@param: *tplData
396-
//@return: null
392+
// @author: [SliverHorn](https://github.com/SliverHorn)
393+
// @author: [songzhibin97](https://github.com/songzhibin97)
394+
// @function: addAutoMoveFile
395+
// @description: 生成对应的迁移文件路径
396+
// @param: *tplData
397+
// @return: null
397398

398399
func (autoCodeService *AutoCodeService) addAutoMoveFile(data *tplData) {
399400
base := filepath.Base(data.autoCodePath)
@@ -433,12 +434,12 @@ func (autoCodeService *AutoCodeService) addAutoMoveFile(data *tplData) {
433434
}
434435
}
435436

436-
//@author: [piexlmax](https://github.com/piexlmax)
437-
//@author: [SliverHorn](https://github.com/SliverHorn)
438-
//@function: CreateApi
439-
//@description: 自动创建api数据,
440-
//@param: a *model.AutoCodeStruct
441-
//@return: err error
437+
// @author: [piexlmax](https://github.com/piexlmax)
438+
// @author: [SliverHorn](https://github.com/SliverHorn)
439+
// @function: CreateApi
440+
// @description: 自动创建api数据,
441+
// @param: a *model.AutoCodeStruct
442+
// @return: err error
442443

443444
func (autoCodeService *AutoCodeService) AutoCreateApi(a *system.AutoCodeStruct) (ids []uint, err error) {
444445
apiList := []system.SysApi{

0 commit comments

Comments
 (0)