| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- package service
- import (
- "go-create/util"
- )
- type GTable struct {
- GenTable GenTable
- GenTableColumn []GenTableColumn
- }
- var GTables = make([]GTable, 0)
- // InitTable 初始化表格生成
- func InitTable() {
- for i := range util.MTables {
- table := util.MTables[i]
- //表格
- gt := GenTable{
- TableName: table.Name,
- TableComment: table.Comment,
- Name: table.GreatHump,
- RouterName: table.LittleHump,
- Remark: table.Comment,
- }
- list, _ := GetGenTableList(gt, 1, 1)
- if list.Total == 0 {
- gt, _ = SaveGenTable(>)
- } else {
- gt = list.List[0].(GenTable)
- }
- gtcs := make([]GenTableColumn, 0)
- for j := range table.MColumns {
- column := table.MColumns[j]
- gtc := GenTableColumn{
- TableId: gt.Id,
- Sort: int64(j),
- ColumnName: column.Name,
- ColumnComment: column.Comment,
- ColumnType: column.SqlTypeName,
- GoType: util.FormatSqlType(column.SqlTypeName),
- GoField: column.GreatHump,
- IsKey: func() string {
- if column.IsKey {
- return "1"
- }
- return "0"
- }(),
- IsIncrement: "0",
- IsRequired: "0",
- QueryType: "",
- VueShowType: "",
- DictType: "",
- }
- subList, _ := GetGenTableColumnList(gtc, 1, 1)
- if subList.Total == 0 {
- gtc, _ = SaveGenTableColumn(>c)
- } else {
- gtc = subList.List[0].(GenTableColumn)
- }
- gtcs = append(gtcs, gtc)
- }
- GTables = append(GTables, GTable{
- GenTable: gt,
- GenTableColumn: gtcs,
- })
- }
- }
- type VMTemple struct {
- Name string
- }
|