pixel
5 years ago
5 changed files with 126 additions and 3 deletions
-
77QMPlusServer/model/autoCodeModel/autoCode.go
-
7QMPlusServer/model/autoCodeModel/autoCode_test.go
-
36QMPlusServer/tpl/te/struct.go.tpl
-
3QMPlusVuePage/src/view/superAdmin/autoCode/component/componentDialog.vue
-
6QMPlusVuePage/src/view/superAdmin/autoCode/index.vue
@ -0,0 +1,7 @@ |
|||
package autoCodeModel |
|||
|
|||
import "testing" |
|||
|
|||
func TestTemp(t *testing.T) { |
|||
Temp() |
|||
} |
@ -0,0 +1,36 @@ |
|||
// 自动生成模板{{.StructName}} |
|||
package {{.PackageName}} |
|||
|
|||
import ( |
|||
"gin-vue-admin/controller/servers" |
|||
"gin-vue-admin/init/qmsql" |
|||
"gin-vue-admin/model/modelInterface" |
|||
"github.com/jinzhu/gorm" |
|||
"github.com/pkg/errors" |
|||
) |
|||
|
|||
type {{.StructName}} struct { |
|||
gorm.Model {{range .Components}} |
|||
{{.ComponentName}} {{.ComponentType}} `json:"{{.ComponentJson}}"` {{ end }} |
|||
} |
|||
|
|||
// 创建{{.StructName}} |
|||
func ({{.Abbreviation}} *{{StructName}})Create{{.StructName}}()(err error){ |
|||
err = qmsql.DEFAULTDB.Create({{.Abbreviation}}).Error |
|||
return err |
|||
} |
|||
|
|||
// 删除{{.StructName}} |
|||
func ({{.Abbreviation}} *{{StructName}})Delete{{.StructName}}()(err error){ |
|||
err = qmsql.DEFAULTDB.Delete({{.Abbreviation}}).Error |
|||
return err |
|||
} |
|||
|
|||
// 更新{{.StructName}} |
|||
func ({{.Abbreviation}} *{{StructName}})Update{{.StructName}}()(err error, re{{.Abbreviation}} {{.StructName}}){ |
|||
|
|||
} |
|||
|
|||
func ({{.Abbreviation}} *{{StructName}})Create(){ |
|||
|
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue