Browse Source

增加自动创建搜索功能 增加搜索条件 增加数据库注释 增加插件功能(0.0.1版 请勿用于生产)

pixel 4 years ago
parent
commit
d8d3cbbbaf

+ 5 - 5
server/api/v1/sys_auto_code.go

@@ -37,31 +37,31 @@ func CreateTemp(c *gin.Context) {
 		apiList := [5]model.SysApi{
 			{
 				Path:        "/" + a.Abbreviation + "/" + "create" + a.StructName,
-				Description: "新增" + a.StructName,
+				Description: "新增" + a.Description,
 				ApiGroup:    a.Abbreviation,
 				Method:      "POST",
 			},
 			{
 				Path:        "/" + a.Abbreviation + "/" + "delete" + a.StructName,
-				Description: "删除" + a.StructName,
+				Description: "删除" + a.Description,
 				ApiGroup:    a.Abbreviation,
 				Method:      "DELETE",
 			},
 			{
 				Path:        "/" + a.Abbreviation + "/" + "update" + a.StructName,
-				Description: "更新" + a.StructName,
+				Description: "更新" + a.Description,
 				ApiGroup:    a.Abbreviation,
 				Method:      "PUT",
 			},
 			{
 				Path:        "/" + a.Abbreviation + "/" + "find" + a.StructName,
-				Description: "根据ID获取" + a.StructName,
+				Description: "根据ID获取" + a.Description,
 				ApiGroup:    a.Abbreviation,
 				Method:      "GET",
 			},
 			{
 				Path:        "/" + a.Abbreviation + "/" + "get" + a.StructName + "List",
-				Description: "获取" + a.StructName + "列表",
+				Description: "获取" + a.Description + "列表",
 				ApiGroup:    a.Abbreviation,
 				Method:      "GET",
 			},

+ 3 - 0
server/core/server.go

@@ -16,10 +16,13 @@ func RunWindowsServer() {
 	}
 	Router := initialize.Routers()
 	Router.Static("/form-generator", "./resource/page")
+
+	// 插件安装 暂时只是后台功能 添加model 添加路由 添加对数据库的操作  详细插件测试模板可看https://github.com/piexlmax/gvaplug  此处不建议投入生产
 	err := initialize.InstallPlug(global.GVA_DB, Router, gvaplug.GvaPlug{})
 	if err != nil {
 		panic(fmt.Sprintf("插件安装失败: %v", err))
 	}
+	// end 插件描述
 
 	address := fmt.Sprintf(":%d", global.GVA_CONFIG.System.Addr)
 	s := &http.Server{

+ 5 - 5
server/model/exa_customer.go

@@ -6,9 +6,9 @@ import (
 
 type ExaCustomer struct {
 	gorm.Model
-	CustomerName       string  `json:"customerName" form:"customerName"`
-	CustomerPhoneData  string  `json:"customerPhoneData" form:"customerPhoneData"`
-	SysUserID          uint    `json:"sysUserId" form:"sysUserId"`
-	SysUserAuthorityID string  `json:"sysUserAuthorityID" form:"sysUserAuthorityID"`
-	SysUser            SysUser `json:"sysUser" form:"sysUser"`
+	CustomerName       string  `json:"customerName" form:"customerName" gorm:"comment:'客户名'"`
+	CustomerPhoneData  string  `json:"customerPhoneData" form:"customerPhoneData" gorm:"comment:'客户手机号'"`
+	SysUserID          uint    `json:"sysUserId" form:"sysUserId" gorm:"comment:'管理ID'"`
+	SysUserAuthorityID string  `json:"sysUserAuthorityID" form:"sysUserAuthorityID" gorm:"comment:'管理角色ID'"`
+	SysUser            SysUser `json:"sysUser" form:"sysUser" gorm:"comment:'管理详情'"`
 }

+ 4 - 4
server/model/exa_file_upload_download.go

@@ -6,8 +6,8 @@ import (
 
 type ExaFileUploadAndDownload struct {
 	gorm.Model
-	Name string `json:"name"`
-	Url  string `json:"url"`
-	Tag  string `json:"tag"`
-	Key  string `json:"key"`
+	Name string `json:"name" gorm:"comment:'文件名'"`
+	Url  string `json:"url" gorm:"comment:'文件地址'"`
+	Tag  string `json:"tag" gorm:"comment:'文件标签'"`
+	Key  string `json:"key" gorm:"comment:'编号'"`
 }

+ 4 - 4
server/model/sys_api.go

@@ -6,8 +6,8 @@ import (
 
 type SysApi struct {
 	gorm.Model
-	Path        string `json:"path"`
-	Description string `json:"description"`
-	ApiGroup    string `json:"apiGroup"`
-	Method      string `json:"method" gorm:"default:'POST'"`
+	Path        string `json:"path" gorm:"comment:'api路径'"`
+	Description string `json:"description" gorm:"comment:'api中文描述'"`
+	ApiGroup    string `json:"apiGroup" gorm:"comment:'api组'"`
+	Method      string `json:"method" gorm:"default:'POST'" gorm:"comment:'方法'"`
 }

+ 3 - 3
server/model/sys_authority.go

@@ -8,9 +8,9 @@ type SysAuthority struct {
 	CreatedAt       time.Time
 	UpdatedAt       time.Time
 	DeletedAt       *time.Time     `sql:"index"`
-	AuthorityId     string         `json:"authorityId" gorm:"not null;unique;primary_key"`
-	AuthorityName   string         `json:"authorityName"`
-	ParentId        string         `json:"parentId"`
+	AuthorityId     string         `json:"authorityId" gorm:"not null;unique;primary_key" gorm:"comment:'角色ID'"`
+	AuthorityName   string         `json:"authorityName" gorm:"comment:'角色名'"`
+	ParentId        string         `json:"parentId" gorm:"comment:'父角色ID'"`
 	DataAuthorityId []SysAuthority `json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id;association_jointable_foreignkey:data_authority_id"`
 	Children        []SysAuthority `json:"children"`
 	SysBaseMenus    []SysBaseMenu  `json:"menus" gorm:"many2many:sys_authority_menus;"`

+ 2 - 2
server/model/sys_authority_menu.go

@@ -2,7 +2,7 @@ package model
 
 type SysMenu struct {
 	SysBaseMenu
-	MenuId      string    `json:"menuId"`
-	AuthorityId string    `json:"-"`
+	MenuId      string    `json:"menuId" gorm:"comment:'菜单ID'"`
+	AuthorityId string    `json:"-" gorm:"comment:'角色ID'"`
 	Children    []SysMenu `json:"children"`
 }

+ 4 - 1
server/model/sys_auto_code.go

@@ -5,6 +5,7 @@ type AutoCodeStruct struct {
 	StructName         string  `json:"structName"`
 	PackageName        string  `json:"packageName"`
 	Abbreviation       string  `json:"abbreviation"`
+	Description		   string `json:"description"`
 	AutoCreateApiToSql bool    `json:"autoCreateApiToSql"`
 	Fields             []Field `json:"fields"`
 }
@@ -14,5 +15,7 @@ type Field struct {
 	FieldDesc  string `json:"fieldDesc"`
 	FieldType  string `json:"fieldType"`
 	FieldJson  string `json:"fieldJson"`
+	Comment    string `json:"comment"`
 	ColumnName string `json:"columnName"`
-}
+	FieldSearchType  string `json:"fieldSearchType"`
+}

+ 11 - 11
server/model/sys_base_menu.go

@@ -7,20 +7,20 @@ import (
 type SysBaseMenu struct {
 	gorm.Model
 	MenuLevel     uint   `json:"-"`
-	ParentId      string `json:"parentId"`
-	Path          string `json:"path"`
-	Name          string `json:"name"`
-	Hidden        bool   `json:"hidden"`
-	Component     string `json:"component"`
-	Sort          int    `json:"sort"`
-	Meta          `json:"meta"`
+	ParentId      string `json:"parentId" gorm:"comment:'父菜单ID'"`
+	Path          string `json:"path" gorm:"comment:'路由path'"`
+	Name          string `json:"name" gorm:"comment:'路由name'"`
+	Hidden        bool   `json:"hidden" gorm:"comment:'是否在列表隐藏'"`
+	Component     string `json:"component" gorm:"comment:'对应前端文件路径'"`
+	Sort          int    `json:"sort" gorm:"comment:'排序标记'"`
+	Meta          `json:"meta" gorm:"comment:'附加属性'"`
 	SysAuthoritys []SysAuthority `json:"authoritys" gorm:"many2many:sys_authority_menus;"`
 	Children      []SysBaseMenu  `json:"children"`
 }
 
 type Meta struct {
-	KeepAlive   bool   `json:"keepAlive"`
-	DefaultMenu bool   `json:"defaultMenu"`
-	Title       string `json:"title"`
-	Icon        string `json:"icon"`
+	KeepAlive   bool   `json:"keepAlive" gorm:"comment:'是否缓存'"`
+	DefaultMenu bool   `json:"defaultMenu" gorm:"comment:'是否是基础路由(开发中)'"`
+	Title       string `json:"title" gorm:"comment:'菜单名'"`
+	Icon        string `json:"icon" gorm:"comment:'菜单图标'"`
 }

+ 1 - 1
server/model/sys_jwt_blacklist.go

@@ -6,5 +6,5 @@ import (
 
 type JwtBlacklist struct {
 	gorm.Model
-	Jwt string `gorm:"type:text"`
+	Jwt string `gorm:"type:text;comment:'jwt'"`
 }

+ 7 - 7
server/model/sys_user.go

@@ -7,12 +7,12 @@ import (
 
 type SysUser struct {
 	gorm.Model
-	UUID        uuid.UUID    `json:"uuid"`
-	Username    string       `json:"userName"`
-	Password    string       `json:"-"`
-	NickName    string       `json:"nickName" gorm:"default:'系统用户'"`
-	HeaderImg   string       `json:"headerImg" gorm:"default:'http://qmplusimg.henrongyi.top/head.png'"`
-	Authority   SysAuthority `json:"authority" gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId"`
-	AuthorityId string       `json:"authorityId" gorm:"default:888"`
+	UUID        uuid.UUID    `json:"uuid" gorm:"comment:'用户UUID'"`
+	Username    string       `json:"userName" gorm:"comment:'用户登录名'"`
+	Password    string       `json:"-"  gorm:"comment:'用户登录密码'"`
+	NickName    string       `json:"nickName" gorm:"default:'系统用户';comment:'用户昵称'" `
+	HeaderImg   string       `json:"headerImg" gorm:"default:'http://qmplusimg.henrongyi.top/head.png';comment:'用户头像'"`
+	Authority   SysAuthority `json:"authority" gorm:"ForeignKey:AuthorityId;AssociationForeignKey:AuthorityId;comment:'用户角色'"`
+	AuthorityId string       `json:"authorityId" gorm:"default:888;comment:'用户角色ID'"`
 }
 

+ 10 - 10
server/model/sys_workflow.go

@@ -7,19 +7,19 @@ import (
 // 工作流属性表
 type SysWorkflow struct {
 	gorm.Model
-	WorkflowNickName    string                `json:"workflowNickName"`    // 工作流名称
-	WorkflowName        string                `json:"workflowName"`        // 工作流英文id
-	WorkflowDescription string                `json:"workflowDescription"` // 工作流描述
-	WorkflowStepInfo    []SysWorkflowStepInfo `json:"workflowStep"`        // 工作流步骤
+	WorkflowNickName    string                `json:"workflowNickName" gorm:"comment:'工作流中文名称'"`    // 工作流名称
+	WorkflowName        string                `json:"workflowName" gorm:"comment:'工作流英文名称'"`        // 工作流英文id
+	WorkflowDescription string                `json:"workflowDescription" gorm:"comment:'工作流描述'"` // 工作流描述
+	WorkflowStepInfo    []SysWorkflowStepInfo `json:"workflowStep" gorm:"comment:'工作流步骤'"`        // 工作流步骤
 }
 
 // 工作流状态表
 type SysWorkflowStepInfo struct {
 	gorm.Model
-	SysWorkflowID   uint    `json:"workflowID"`      // 所属工作流ID
-	IsStrat         bool    `json:"isStrat"`         // 是否是开始流节点
-	StepName        string  `json:"stepName"`        // 工作流名称
-	StepNo          float64 `json:"stepNo"`          // 步骤id (第几步)
-	StepAuthorityID string  `json:"stepAuthorityID"` // 操作者级别id
-	IsEnd           bool    `json:"isEnd"`           // 是否是完结流节点
+	SysWorkflowID   uint    `json:"workflowID" gorm:"comment:'所属工作流ID'"`      // 所属工作流ID
+	IsStrat         bool    `json:"isStrat" gorm:"comment:'是否是开始流节点'"`         // 是否是开始流节点
+	StepName        string  `json:"stepName" gorm:"comment:'工作流节点名称'"`        // 工作流名称
+	StepNo          float64 `json:"stepNo" gorm:"comment:'步骤id (第几步)'"`          // 步骤id (第几步)
+	StepAuthorityID string  `json:"stepAuthorityID" gorm:"comment:'操作者级别id'"` // 操作者级别id
+	IsEnd           bool    `json:"isEnd" gorm:"comment:'是否是完结流节点'"`           // 是否是完结流节点
 }

+ 6 - 6
server/model/sys_workflow_process.go

@@ -5,10 +5,10 @@ import "github.com/jinzhu/gorm"
 // 工作流流转表
 type SysWorkFlowProcess struct {
 	gorm.Model
-	ApplicationID  uint   // 当前工作流所属申请的ID
-	CurrentNode    string // 当前进度节点
-	HistoricalNode string // 上一个进度节点
-	CurrentUser    string // 当前进度操作人
-	HistoricalUser string // 上一个进度的操作人
-	State          bool   // 状态 是否是正在进行的状态
+	ApplicationID  uint   `json:"applicationID" gorm:"comment:'当前工作流所属申请的ID'"`// 当前工作流所属申请的ID
+	CurrentNode    string `json:"currentNode" gorm:"comment:'当前进度节点'"`// 当前进度节点
+	HistoricalNode string `json:"historicalNode" gorm:"comment:'上一个进度节点'"`// 上一个进度节点
+	CurrentUser    string `json:"currentUser" gorm:"comment:'当前进度操作人'"`// 当前进度操作人
+	HistoricalUser string `json:"historicalUser" gorm:"comment:'上一个进度的操作人'"`// 上一个进度的操作人
+	State          bool   `json:"state" gorm:"comment:'状态 是否是正在进行的状态'"`// 状态 是否是正在进行的状态
 }

+ 17 - 2
server/resource/template/fe/table.vue.tpl

@@ -2,9 +2,18 @@
   <div>
     <div class="search-term">
       <el-form :inline="true" :model="searchInfo" class="demo-form-inline">
-            此处请使用表单生成器生成form填充 表单默认绑定 formData 如手动修改过请自行修改key
+           {{- range .Fields}}
+              {{- if .FieldSearchType}}
+        <el-form-item label="{{.FieldDesc}}">
+          <el-input placeholder="搜索条件" v-model="searchInfo.{{.FieldJson}}"></el-input>
+        </el-form-item>
+              {{ end }}
+           {{ end }}
+        <el-form-item>
+          <el-button @click="onSubmit" type="primary">查询</el-button>
+        </el-form-item>
         <el-form-item>
-          <el-button @click="openDialog" type="primary">新增</el-button>
+          <el-button @click="openDialog" type="primary">新增api</el-button>
         </el-form-item>
       </el-form>
     </div>
@@ -95,6 +104,12 @@ export default {
     }
   },
   methods: {
+      //条件搜索前端看此方法
+      onSubmit() {
+        this.page = 1
+        this.pageSize = 10
+        this.getTableData()
+      },
     async update{{.StructName}}(row) {
       const res = await find{{.StructName}}({ ID: row.ID });
       this.type = "update";

+ 2 - 2
server/resource/template/te/api.go.tpl

@@ -91,11 +91,11 @@ func Find{{.StructName}}(c *gin.Context) {
 // @Security ApiKeyAuth
 // @accept application/json
 // @Produce application/json
-// @Param data body request.PageInfo true "分页获取{{.StructName}}列表"
+// @Param data body request.{{.StructName}}Search true "分页获取{{.StructName}}列表"
 // @Success 200 {string} string "{"success":true,"data":{},"msg":"获取成功"}"
 // @Router /{{.Abbreviation}}/get{{.StructName}}List [get]
 func Get{{.StructName}}List(c *gin.Context) {
-	var pageInfo request.PageInfo
+	var pageInfo request.{{.StructName}}Search
 	_ = c.ShouldBindQuery(&pageInfo)
 	err, list, total := service.Get{{.StructName}}InfoList(pageInfo)
 	if err != nil {

+ 2 - 1
server/resource/template/te/model.go.tpl

@@ -5,7 +5,8 @@ import (
 	"github.com/jinzhu/gorm"
 )
 
+// 如果含有time.Time 请自行import time包
 type {{.StructName}} struct {
       gorm.Model {{range .Fields}}
-      {{.FieldName}}  {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" {{if .ColumnName}} gorm:"column:{{.ColumnName}}"{{end}}`{{ end }}
+      {{.FieldName}}  {{.FieldType}} `json:"{{.FieldJson}}" form:"{{.FieldJson}}" gorm:"column:{{.ColumnName}};comment:'{{.Comment}}'"`{{ end }}
 }

+ 8 - 0
server/resource/template/te/request.go.tpl

@@ -0,0 +1,8 @@
+package request
+
+import "gin-vue-admin/model"
+
+type {{.StructName}}Search struct{
+    model.{{.StructName}}
+    PageInfo
+}

+ 30 - 3
server/resource/template/te/service.go.tpl

@@ -57,12 +57,39 @@ func Get{{.StructName}}(id uint) (err error, {{.Abbreviation}} model.{{.StructNa
 // @param     info            PageInfo
 // @return                    error
 
-func Get{{.StructName}}InfoList(info request.PageInfo) (err error, list interface{}, total int) {
+func Get{{.StructName}}InfoList(info request.{{.StructName}}Search) (err error, list interface{}, total int) {
 	limit := info.PageSize
 	offset := info.PageSize * (info.Page - 1)
+    // 创建db
 	db := global.GVA_DB
-	var {{.Abbreviation}}s []model.{{.StructName}}
+    var {{.Abbreviation}}s []model.{{.StructName}}
+    // 如果有条件搜索 下方会自动创建搜索语句
+        {{- range .Fields}}
+            {{- if .FieldSearchType}}
+                {{- if eq .FieldType "string" }}
+    if info.{{.FieldName}} != "" {
+        db = db.Where("{{.ColumnName}} {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+ {{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
+    }
+                {{- else if eq .FieldType "bool" }}
+    if info.{{.FieldName}} != 0 {
+        db = db.Where("{{.ColumnName}} {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+{{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
+    }
+                {{- else if eq .FieldType "int" }}
+    if info.{{.FieldName}} != 0 {
+        db = db.Where("{{.ColumnName}} {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+{{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
+    }
+                {{- else if eq .FieldType "float64" }}
+    if info.{{.FieldName}} != 0 {
+        db = db.Where("{{.ColumnName}} {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+{{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
+    }
+                {{- else if eq .FieldType "time.Time" }}
+    if !info.{{.FieldName}}.IsZero() {
+         db = db.Where("{{.ColumnName}} {{.FieldSearchType}} ?",{{if eq .FieldSearchType "LIKE"}}"%"+{{ end }}info.{{.FieldName}}{{if eq .FieldSearchType "LIKE"}}+"%"{{ end }})
+    }
+                {{- end }}
+        {{- end }}
+    {{- end }}
 	err = db.Find(&{{.Abbreviation}}s).Count(&total).Error
 	err = db.Limit(limit).Offset(offset).Find(&{{.Abbreviation}}s).Error
 	return err, {{.Abbreviation}}s, total
-}
+}

+ 41 - 0
web/src/view/systemTools/autoCode/component/fieldDialog.vue

@@ -1,5 +1,6 @@
 <template>
     <div>
+        <span style="color:red">搜索时如果条件为LIKE只支持字符串</span>
         <el-form :model="dialogMiddle" ref="fieldDialogFrom" label-width="120px" label-position="left" :rules="rules">
             <el-form-item label="Field名称" prop="fieldName">
                 <el-col :span="6">
@@ -21,6 +22,11 @@
                 <el-input v-model="dialogMiddle.columnName" autocomplete="off"></el-input>
                 </el-col>
             </el-form-item>
+            <el-form-item label="数据库字段描述" prop="comment">
+                <el-col :span="6">
+                <el-input v-model="dialogMiddle.comment" autocomplete="off"></el-input>
+                </el-col>
+            </el-form-item>
             <el-form-item label="Field数据类型" prop="fieldType">
                 <el-col :span="8">
             <el-select v-model="dialogMiddle.fieldType" placeholder="请选择field数据类型">
@@ -33,6 +39,18 @@
             </el-select>
                 </el-col>
             </el-form-item>
+            <el-form-item label="Field查询条件" prop="fieldSearchType">
+                <el-col :span="8">
+            <el-select v-model="dialogMiddle.fieldSearchType" placeholder="请选择field数据类型">
+                <el-option
+                    v-for="item in typeSearchOptions"
+                    :key="item.value"
+                    :label="item.label"
+                    :value="item.value">
+                </el-option>
+            </el-select>
+                </el-col>
+            </el-form-item>
         </el-form>
     </div>
 </template>
@@ -50,6 +68,28 @@ export default {
     data(){
         return{
             visible:false,
+            typeSearchOptions:[
+                {
+                    label:"=",
+                    value:"="
+                },
+                {
+                    label:"<>",
+                    value:"<>"
+                },
+                {
+                    label:">",
+                    value:">"
+                },
+                {
+                    label:"<",
+                    value:"<"
+                },
+                {
+                    label:"LIKE",
+                    value:"LIKE"
+                },
+            ],
             typeOptions:[
                 {
                     label:"字符串",
@@ -76,6 +116,7 @@ export default {
                 fieldName:[ { required: true, message: '请输入field英文名', trigger: 'blur' }],
                 fieldDesc:[ { required: true, message: '请输入field中文名', trigger: 'blur' }],
                 fieldJson:[ { required: true, message: '请输入field格式化json', trigger: 'blur' }],
+                columnName:[{ required: true, message: '请输入数据库字段', trigger: 'blur' }],
                 fieldType:[ { required: true, message: '请选择field数据类型', trigger: 'blur' }]
             }
 

+ 22 - 2
web/src/view/systemTools/autoCode/index.vue

@@ -8,11 +8,14 @@
       <el-form-item label="Struct简称" prop="abbreviation">
         <el-input v-model="form.abbreviation" placeholder="简称会作为入参对象名和路由group"></el-input>
       </el-form-item>
+      <el-form-item label="Struct中文名称" prop="description">
+        <el-input v-model="form.description" placeholder="中文描述作为自动api描述"></el-input>
+      </el-form-item>
       <el-form-item label="文件名称" prop="packageName">
         <el-input v-model="form.packageName"></el-input>
       </el-form-item>
-      <el-form-item>
-        <el-checkbox v-model="form.autoCreateApiToSql">自动创建api</el-checkbox>
+      <el-form-item label="自动创建api">
+        <el-checkbox v-model="form.autoCreateApiToSql"></el-checkbox>
       </el-form-item>
     </el-form>
     <!-- 组件列表 -->
@@ -30,6 +33,12 @@
       </el-table-column>
       <el-table-column prop="fieldType" label="Field数据类型" width="130">
       </el-table-column>
+      <el-table-column prop="columnName" label="数据库字段" width="130">
+      </el-table-column>
+      <el-table-column prop="comment" label="数据库字段描述" width="130">
+      </el-table-column>
+      <el-table-column prop="fieldSearchType" label="搜索条件" width="130">
+      </el-table-column>
       <el-table-column label="操作" width="250">
         <template slot-scope="scope">
           <el-button size="mini" type="text" @click="editAndAddField(scope.row)">编辑</el-button>
@@ -67,6 +76,8 @@ const fieldTemplate = {
   fieldType: '',
   fieldJson: '',
   columnName: '',
+  comment:'',
+  fieldSearchType:''
 }
 
 import FieldDialog from '@/view/systemTools/autoCode/component/fieldDialog.vue'
@@ -81,12 +92,14 @@ export default {
         structName: '',
         packageName: '',
         abbreviation: '',
+        description:'',
         autoCreateApiToSql: false,
         fields: [],
       },
       rules: {
         structName: [{ required: true, message: '请输入结构体名称', trigger: 'blur' }],
         abbreviation: [{ required: true, message: '请输入结构体简称', trigger: 'blur' }],
+        description: [{ required: true, message: '请输入结构体描述', trigger: 'blur' }],
         packageName: [{ required: true, message: '请输入包名称', trigger: 'blur' }],
       },
       dialogMiddle: {},
@@ -156,6 +169,13 @@ export default {
         })
         return false
       }
+      if(this.form.fields.some(item=>item.fieldName == this.form.structName)){
+        this.$message({
+          type: 'error',
+          message: '存在与结构体同名的字段',
+        })
+        return false
+      }
       this.$refs.autoCodeForm.validate(async (valid) => {
         if (valid) {
           this.form.structName = toUpperCase(this.form.structName)