package examtestpage import ( "fmt" "github.com/flipped-aurora/gin-vue-admin/server/global" "github.com/flipped-aurora/gin-vue-admin/server/model/common/response" "github.com/flipped-aurora/gin-vue-admin/server/model/wechat" "github.com/gin-gonic/gin" ) //集团分厂管理模块 type GroupHandleApi struct{} //集团栏目 type GroupMap struct { Id int64 `json:"id" gorm:"column:g_id;type:bigint(20);;primaryKey;unique;not null;autoIncrement;index"` Name string `json:"name" gorm:"column:g_name;type:varchar(255);not null;comment:组织名称"` //'组织名称', Time int64 `json:"time" gorm:"column:g_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` //'编辑时间', } //集团列表 func (g *GroupHandleApi) GroupList(c *gin.Context) { var groupStruct []wechat.GroupForm //集团表结构 var groupMap []GroupMap //要获取的集团架构字段 err := global.GVA_DB_WatchDate.Model(&groupStruct).Where("g_parentid = ?", 1).Find(&groupMap) //获取集团信息 if err != nil { // return } for _, v := range groupMap { fmt.Printf("%v\n", v.Name) } fmt.Printf("%v\n", groupMap) response.Ok(c) }