Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	template/v4/dto.go.template
This commit is contained in:
linwenxiang committed 2021-03-04 23:47:14 +08:00
commit c294bb1585
33 files changed
+1014 -83

No files matched your search

+14 -14
View File
@@ -21,17 +21,17 @@ func Preview(c *gin.Context) {
id, err := tools2.StringToInt(c.Param("tableId"))
tools2.HasError(err, "", -1)
table.TableId = id
t1, err := template.ParseFiles("template/v3/model.go.template")
t1, err := template.ParseFiles("template/v4/model.go.template")
tools2.HasError(err, "", -1)
t2, err := template.ParseFiles("template/v3/no_actions/apis.go.template")
t2, err := template.ParseFiles("template/v4/no_actions/apis.go.template")
tools2.HasError(err, "", -1)
t3, err := template.ParseFiles("template/v3/js.go.template")
t3, err := template.ParseFiles("template/v4/js.go.template")
tools2.HasError(err, "", -1)
t4, err := template.ParseFiles("template/v3/vue.go.template")
t4, err := template.ParseFiles("template/v4/vue.go.template")
tools2.HasError(err, "", -1)
t5, err := template.ParseFiles("template/v3/no_actions/router_check_role.go.template")
t5, err := template.ParseFiles("template/v4/no_actions/router_check_role.go.template")
tools2.HasError(err, "", -1)
t6, err := template.ParseFiles("template/v3/dto.go.template")
t6, err := template.ParseFiles("template/v4/dto.go.template")
tools2.HasError(err, "", -1)
db, err := tools2.GetOrm(c)
@@ -95,7 +95,7 @@ func GenCodeV3(c *gin.Context) {
func NOActionsGenV3(tab tools.SysTables) {
basePath := "template/v3/"
basePath := "template/v4/"
routerFile := basePath + "no_actions/router_check_role.go.template"
if tab.IsAuth == 2 {
@@ -149,7 +149,7 @@ func NOActionsGenV3(tab tools.SysTables) {
}
func ActionsGenV3(tab tools.SysTables) {
basePath := "template/v3/"
basePath := "template/v4/"
routerFile := basePath + "actions/router_check_role.go.template"
if tab.IsAuth == 2 {
@@ -234,7 +234,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"
@@ -254,7 +254,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
@@ -273,7 +273,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
@@ -292,7 +292,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
@@ -311,7 +311,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
@@ -433,4 +433,4 @@ func GenMenuAndApi(c *gin.Context) {
ADelete.MenuId, err = ADelete.Create(db)
app.OK(c, "", "数据生成成功!")
}
}
+4 -6
View File
@@ -232,8 +232,8 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
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
}
@@ -245,10 +245,8 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
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"