feat✨ :模版优化
This commit is contained in:
1 parent
734a48dbb8
commit
19e96a01de
7 files changed
+25
-28
No files matched your search
@@ -206,7 +206,7 @@ func GenMenuAndApi(c *gin.Context) {
|
|||||||
Cmenu.Path = tab.TBName
|
Cmenu.Path = tab.TBName
|
||||||
Cmenu.MenuType = "C"
|
Cmenu.MenuType = "C"
|
||||||
Cmenu.Action = "无"
|
Cmenu.Action = "无"
|
||||||
Cmenu.Permission = tab.ModuleName + ":" + tab.BusinessName + ":list"
|
Cmenu.Permission = tab.PackageName + ":" + tab.BusinessName + ":list"
|
||||||
Cmenu.ParentId = Mmenu.MenuId
|
Cmenu.ParentId = Mmenu.MenuId
|
||||||
Cmenu.NoCache = false
|
Cmenu.NoCache = false
|
||||||
Cmenu.Component = "/" + tab.BusinessName + "/index"
|
Cmenu.Component = "/" + tab.BusinessName + "/index"
|
||||||
@@ -226,7 +226,7 @@ func GenMenuAndApi(c *gin.Context) {
|
|||||||
MList.Path = tab.TBName
|
MList.Path = tab.TBName
|
||||||
MList.MenuType = "F"
|
MList.MenuType = "F"
|
||||||
MList.Action = "无"
|
MList.Action = "无"
|
||||||
MList.Permission = tab.ModuleName + ":" + tab.BusinessName + ":query"
|
MList.Permission = tab.PackageName + ":" + tab.BusinessName + ":query"
|
||||||
MList.ParentId = Cmenu.MenuId
|
MList.ParentId = Cmenu.MenuId
|
||||||
MList.NoCache = false
|
MList.NoCache = false
|
||||||
MList.Sort = 0
|
MList.Sort = 0
|
||||||
@@ -245,7 +245,7 @@ func GenMenuAndApi(c *gin.Context) {
|
|||||||
MCreate.Path = tab.TBName
|
MCreate.Path = tab.TBName
|
||||||
MCreate.MenuType = "F"
|
MCreate.MenuType = "F"
|
||||||
MCreate.Action = "无"
|
MCreate.Action = "无"
|
||||||
MCreate.Permission = tab.ModuleName + ":" + tab.BusinessName + ":add"
|
MCreate.Permission = tab.PackageName + ":" + tab.BusinessName + ":add"
|
||||||
MCreate.ParentId = Cmenu.MenuId
|
MCreate.ParentId = Cmenu.MenuId
|
||||||
MCreate.NoCache = false
|
MCreate.NoCache = false
|
||||||
MCreate.Sort = 0
|
MCreate.Sort = 0
|
||||||
@@ -264,7 +264,7 @@ func GenMenuAndApi(c *gin.Context) {
|
|||||||
MUpdate.Path = tab.TBName
|
MUpdate.Path = tab.TBName
|
||||||
MUpdate.MenuType = "F"
|
MUpdate.MenuType = "F"
|
||||||
MUpdate.Action = "无"
|
MUpdate.Action = "无"
|
||||||
MUpdate.Permission = tab.ModuleName + ":" + tab.BusinessName + ":edit"
|
MUpdate.Permission = tab.PackageName + ":" + tab.BusinessName + ":edit"
|
||||||
MUpdate.ParentId = Cmenu.MenuId
|
MUpdate.ParentId = Cmenu.MenuId
|
||||||
MUpdate.NoCache = false
|
MUpdate.NoCache = false
|
||||||
MUpdate.Sort = 0
|
MUpdate.Sort = 0
|
||||||
@@ -283,7 +283,7 @@ func GenMenuAndApi(c *gin.Context) {
|
|||||||
MDelete.Path = tab.TBName
|
MDelete.Path = tab.TBName
|
||||||
MDelete.MenuType = "F"
|
MDelete.MenuType = "F"
|
||||||
MDelete.Action = "无"
|
MDelete.Action = "无"
|
||||||
MDelete.Permission = tab.ModuleName + ":" + tab.BusinessName + ":remove"
|
MDelete.Permission = tab.PackageName + ":" + tab.BusinessName + ":remove"
|
||||||
MDelete.ParentId = Cmenu.MenuId
|
MDelete.ParentId = Cmenu.MenuId
|
||||||
MDelete.NoCache = false
|
MDelete.NoCache = false
|
||||||
MDelete.Sort = 0
|
MDelete.Sort = 0
|
||||||
|
|||||||
@@ -191,8 +191,8 @@ func genTableInit(tablesList []string, i int, c *gin.Context) (tools.SysTables,
|
|||||||
column.IsPk = "1"
|
column.IsPk = "1"
|
||||||
column.Pk = true
|
column.Pk = true
|
||||||
data.PkColumn = dbcolumn[i].ColumnName
|
data.PkColumn = dbcolumn[i].ColumnName
|
||||||
column.GoField = strings.ToUpper(column.GoField)
|
//column.GoField = strings.ToUpper(column.GoField)
|
||||||
column.JsonField = strings.ToUpper(column.JsonField)
|
//column.JsonField = strings.ToUpper(column.JsonField)
|
||||||
data.PkGoField = column.GoField
|
data.PkGoField = column.GoField
|
||||||
data.PkJsonField = column.JsonField
|
data.PkJsonField = column.JsonField
|
||||||
}
|
}
|
||||||
@@ -204,9 +204,7 @@ func genTableInit(tablesList []string, i int, c *gin.Context) (tools.SysTables,
|
|||||||
|
|
||||||
if strings.Contains(dbcolumn[i].ColumnType, "int") {
|
if strings.Contains(dbcolumn[i].ColumnType, "int") {
|
||||||
if strings.Contains(dbcolumn[i].ColumnKey, "PR") {
|
if strings.Contains(dbcolumn[i].ColumnKey, "PR") {
|
||||||
column.GoType = "uint"
|
column.GoType = "int"
|
||||||
} else if strings.Contains(dbcolumn[i].ColumnType, "unsigned") {
|
|
||||||
column.GoType = "uint"
|
|
||||||
} else {
|
} else {
|
||||||
column.GoType = "string"
|
column.GoType = "string"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package {{.Package}}
|
package {{.Package}}
|
||||||
|
|
||||||
import (
|
import (
|
||||||
//"go-admin/app/admin/models"
|
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package router
|
|||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"go-admin/app/admin/middleware"
|
"go-admin/app/{{.PackageName}}/middleware"
|
||||||
"go-admin/app/admin/models"
|
"go-admin/app/{{.PackageName}}/models"
|
||||||
"go-admin/app/admin/service/dto"
|
"go-admin/app/{{.PackageName}}/service/dto"
|
||||||
"go-admin/common/actions"
|
"go-admin/common/actions"
|
||||||
jwt "go-admin/pkg/jwtauth"
|
jwt "go-admin/pkg/jwtauth"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package router
|
|||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
|
||||||
"go-admin/app/admin/middleware"
|
"go-admin/app/{{.PackageName}}/middleware"
|
||||||
"go-admin/app/admin/models"
|
"go-admin/app/{{.PackageName}}/models"
|
||||||
"go-admin/app/admin/service/dto"
|
"go-admin/app/{{.PackageName}}/service/dto"
|
||||||
"go-admin/common/actions"
|
"go-admin/common/actions"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
|
|
||||||
"go-admin/app/admin/models"
|
"go-admin/app/{{.PackageName}}/models"
|
||||||
"go-admin/common/dto"
|
"go-admin/common/dto"
|
||||||
"go-admin/common/log"
|
"go-admin/common/log"
|
||||||
"go-admin/tools"
|
"go-admin/tools"
|
||||||
|
|||||||
+10
-10
@@ -46,7 +46,7 @@
|
|||||||
<el-row :gutter="10" class="mb8">
|
<el-row :gutter="10" class="mb8">
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
v-permisaction="['{{.PackageName}}:{{.ModuleName}}:add']"
|
v-permisaction="['{{.PackageName}}:{{.BusinessName}}:add']"
|
||||||
type="primary"
|
type="primary"
|
||||||
icon="el-icon-plus"
|
icon="el-icon-plus"
|
||||||
size="mini"
|
size="mini"
|
||||||
@@ -56,7 +56,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
v-permisaction="['{{.PackageName}}:{{.ModuleName}}:edit']"
|
v-permisaction="['{{.PackageName}}:{{.BusinessName}}:edit']"
|
||||||
type="success"
|
type="success"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
size="mini"
|
size="mini"
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="1.5">
|
<el-col :span="1.5">
|
||||||
<el-button
|
<el-button
|
||||||
v-permisaction="['{{.PackageName}}:{{.ModuleName}}:remove']"
|
v-permisaction="['{{.PackageName}}:{{.BusinessName}}:remove']"
|
||||||
type="danger"
|
type="danger"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
size="mini"
|
size="mini"
|
||||||
@@ -111,7 +111,7 @@
|
|||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-permisaction="['{{.PackageName}}:{{.ModuleName}}:edit']"
|
v-permisaction="['{{.PackageName}}:{{.BusinessName}}:edit']"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-edit"
|
icon="el-icon-edit"
|
||||||
@@ -119,7 +119,7 @@
|
|||||||
>修改
|
>修改
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-permisaction="['{{.PackageName}}:{{.ModuleName}}:remove']"
|
v-permisaction="['{{.PackageName}}:{{.BusinessName}}:remove']"
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@@ -145,11 +145,11 @@
|
|||||||
{{- $x := .IsInsert -}}
|
{{- $x := .IsInsert -}}
|
||||||
{{- if (eq $x "1") -}}
|
{{- if (eq $x "1") -}}
|
||||||
{{- if (.Pk) }}
|
{{- if (.Pk) }}
|
||||||
{{- else if eq .GoField "CreatedAt" -}}
|
{{- else if eq .GoField "createdAt" -}}
|
||||||
{{- else if eq .GoField "UpdatedAt" -}}
|
{{- else if eq .GoField "updatedAt" -}}
|
||||||
{{- else if eq .GoField "DeletedAt" -}}
|
{{- else if eq .GoField "deletedAt" -}}
|
||||||
{{- else if eq .GoField "UpdateBy" -}}
|
{{- else if eq .GoField "updateBy" -}}
|
||||||
{{- else if eq .GoField "CreateBy" -}}
|
{{- else if eq .GoField "createBy" -}}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
<el-form-item label="{{.ColumnComment}}" prop="{{.JsonField}}">
|
<el-form-item label="{{.ColumnComment}}" prop="{{.JsonField}}">
|
||||||
{{ if eq "input" .HtmlType -}}
|
{{ if eq "input" .HtmlType -}}
|
||||||
|
|||||||
Reference in new issue
Block a user