Skip to content

Commit d1b7c2d

Browse files
committed
feature: 自动化代码方法支持增加方法描述
1 parent 3c7a05b commit d1b7c2d

File tree

5 files changed

+16
-10
lines changed

5 files changed

+16
-10
lines changed

server/model/system/request/sys_auto_code.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ type AutoFunc struct {
236236
Package string `json:"package"`
237237
FuncName string `json:"funcName"` // 方法名称
238238
Router string `json:"router"` // 路由名称
239+
FuncDesc string `json:"funcDesc"` // 方法介绍
239240
BusinessDB string `json:"businessDB"` // 业务库
240241
StructName string `json:"structName"` // Struct名称
241242
PackageName string `json:"packageName"` // 文件名称

server/resource/function/api.go.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{if .IsPlugin}}
2-
// {{.FuncName}} 等待开发的的{{.Description}}接口
2+
// {{.FuncName}} {{.FuncDesc}}
33
// @Tags {{.StructName}}
4-
// @Summary 等待开发的的{{.Description}}接口
4+
// @Summary {{.FuncDesc}}
55
// @accept application/json
66
// @Produce application/json
77
// @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表"
@@ -20,9 +20,9 @@ func (a *{{.Abbreviation}}) {{.FuncName}}(c *gin.Context) {
2020

2121
{{- else -}}
2222

23-
// {{.FuncName}} 等待开发的的{{.Description}}接口
23+
// {{.FuncName}} {{.FuncDesc}}
2424
// @Tags {{.StructName}}
25-
// @Summary 等待开发的的{{.Description}}接口
25+
// @Summary {{.FuncDesc}}
2626
// @accept application/json
2727
// @Produce application/json
2828
// @Param data query {{.Package}}Req.{{.StructName}}Search true "成功"

server/resource/function/api.js.tpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{if .IsPlugin}}
2-
// {{.FuncName}} 等待开发的的{{.Description}}接口
2+
// {{.FuncName}} {{.FuncDesc}}
33
// @Tags {{.StructName}}
4-
// @Summary 等待开发的的{{.Description}}接口
4+
// @Summary {{.FuncDesc}}
55
// @accept application/json
66
// @Produce application/json
77
// @Param data query request.{{.StructName}}Search true "分页获取{{.Description}}列表"
@@ -16,9 +16,9 @@ export const {{.Router}} = () => {
1616

1717
{{- else -}}
1818

19-
// {{.FuncName}} 等待开发的的{{.Description}}接口
19+
// {{.FuncName}} {{.FuncDesc}}
2020
// @Tags {{.StructName}}
21-
// @Summary 等待开发的的{{.Description}}接口
21+
// @Summary {{.FuncDesc}}
2222
// @accept application/json
2323
// @Produce application/json
2424
// @Param data query {{.Package}}Req.{{.StructName}}Search true "成功"

server/resource/function/server.go.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{{- end}}
77
{{if .IsPlugin}}
88

9-
// {{.FuncName}} 请实现方法
9+
// {{.FuncName}} {{.FuncDesc}}
1010
// Author [yourname](https://github.com/yourname)
1111
func (s *{{.Abbreviation}}) {{.FuncName}}() (err error) {
1212
db := {{$db}}.Model(&model.{{.StructName}}{})
@@ -15,7 +15,7 @@ func (s *{{.Abbreviation}}) {{.FuncName}}() (err error) {
1515

1616
{{- else -}}
1717

18-
// {{.FuncName}} 请实现方法
18+
// {{.FuncName}} {{.FuncDesc}}
1919
// Author [yourname](https://github.com/yourname)
2020
func ({{.Abbreviation}}Service *{{.StructName}}Service){{.FuncName}}() (err error) {
2121
// 请在这里实现自己的业务逻辑

web/src/view/systemTools/autoCodeAdmin/index.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@
177177
<el-form-item label="缩写:">
178178
<el-input v-model="autoFunc.abbreviation" placeholder="请输入缩写" disabled />
179179
</el-form-item>
180+
<el-form-item label="方法名:">
181+
<el-input v-model="autoFunc.funcDesc" placeholder="请输入方法介绍" />
182+
</el-form-item>
180183
<el-form-item label="方法名:">
181184
<el-input v-model="autoFunc.funcName" placeholder="请输入方法名" />
182185
</el-form-item>
@@ -238,6 +241,7 @@ const autoFunc = ref({
238241
humpPackageName:"",
239242
businessDB:"",
240243
method:"",
244+
funcDesc: ""
241245
})
242246
243247
const addFuncBtn = (row) => {
@@ -252,6 +256,7 @@ const addFuncBtn = (row) => {
252256
autoFunc.value.method = ""
253257
autoFunc.value.funcName = ""
254258
autoFunc.value.router = ""
259+
autoFunc.value.funcDesc = "方法介绍"
255260
funcFlag.value = true;
256261
};
257262

0 commit comments

Comments
 (0)