feat✨ :模版优化

This commit is contained in:
zhangwenjian committed 2021-02-25 23:40:55 +08:00
1 parent 734a48dbb8
commit 19e96a01de
7 files changed
+26 -29

No files matched your search

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