|
@@ -0,0 +1,130 @@
|
|
|
+package data_manage
|
|
|
+
|
|
|
+import (
|
|
|
+ "eta/eta_mobile/utils"
|
|
|
+ "fmt"
|
|
|
+ "github.com/beego/beego/v2/client/orm"
|
|
|
+ "strings"
|
|
|
+ "time"
|
|
|
+)
|
|
|
+
|
|
|
+// AiPredictModelFramework 图库框架表
|
|
|
+type AiPredictModelFramework struct {
|
|
|
+ AiPredictModelFrameworkId int `orm:"column(ai_predict_model_framework_id);pk" gorm:"primaryKey"`
|
|
|
+ FrameworkCode string `description:"框架唯一编码"`
|
|
|
+ FrameworkName string `description:"框架名称"`
|
|
|
+ FrameworkImg string `description:"框架图片"`
|
|
|
+ FrameworkContent string `description:"框架内容"`
|
|
|
+ IsPublic int `description:"是否公开:0-私有;1-公开"`
|
|
|
+ PublicTime time.Time `description:"公开时间"`
|
|
|
+ Sort int `description:"排序"`
|
|
|
+ AdminId int `description:"创建人ID"`
|
|
|
+ AdminName string `description:"创建人姓名"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ ModifyTime time.Time `description:"更新时间"`
|
|
|
+}
|
|
|
+
|
|
|
+func (m *AiPredictModelFramework) TableName() string {
|
|
|
+ return "ai_predict_model_framework"
|
|
|
+}
|
|
|
+
|
|
|
+func (m *AiPredictModelFramework) PrimaryId() string {
|
|
|
+ return AiPredictModelFrameworkColumns.AiPredictModelFrameworkId
|
|
|
+}
|
|
|
+
|
|
|
+var AiPredictModelFrameworkColumns = struct {
|
|
|
+ AiPredictModelFrameworkId string
|
|
|
+ FrameworkCode string
|
|
|
+ FrameworkName string
|
|
|
+ FrameworkImg string
|
|
|
+ FrameworkContent string
|
|
|
+ IsPublic string
|
|
|
+ PublicTime string
|
|
|
+ Sort string
|
|
|
+ AdminId string
|
|
|
+ AdminName string
|
|
|
+ CreateTime string
|
|
|
+ ModifyTime string
|
|
|
+}{
|
|
|
+ AiPredictModelFrameworkId: "ai_predict_model_framework_id",
|
|
|
+ FrameworkCode: "framework_code",
|
|
|
+ FrameworkName: "framework_name",
|
|
|
+ FrameworkImg: "framework_img",
|
|
|
+ FrameworkContent: "framework_content",
|
|
|
+ IsPublic: "is_public",
|
|
|
+ PublicTime: "public_time",
|
|
|
+ Sort: "sort",
|
|
|
+ AdminId: "admin_id",
|
|
|
+ AdminName: "admin_name",
|
|
|
+ CreateTime: "create_time",
|
|
|
+ ModifyTime: "modify_time",
|
|
|
+}
|
|
|
+
|
|
|
+func (m *AiPredictModelFramework) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*AiPredictModelFramework, err error) {
|
|
|
+ o := orm.NewOrmUsingDB("data")
|
|
|
+ fields := strings.Join(fieldArr, ",")
|
|
|
+ if len(fieldArr) == 0 {
|
|
|
+ fields = `*`
|
|
|
+ }
|
|
|
+ order := `ORDER BY create_time DESC`
|
|
|
+ if orderRule != "" {
|
|
|
+ order = ` ORDER BY ` + orderRule
|
|
|
+ }
|
|
|
+ sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
|
|
|
+ _, err = o.Raw(sql, pars...).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// AiPredictModelFrameworkItem 图库框架表信息
|
|
|
+type AiPredictModelFrameworkItem struct {
|
|
|
+ AiPredictModelFrameworkId int `description:"框架ID"`
|
|
|
+ FrameworkCode string `description:"框架唯一编码"`
|
|
|
+ FrameworkName string `description:"框架名称"`
|
|
|
+ FrameworkImg string `description:"框架图片"`
|
|
|
+ FrameworkContent string `description:"框架内容"`
|
|
|
+ IsPublic int `description:"是否公开:0-私有;1-公开"`
|
|
|
+ PublicTime string `description:"公开时间"`
|
|
|
+ Sort int `description:"排序"`
|
|
|
+ AdminId int `description:"创建人ID"`
|
|
|
+ AdminName string `description:"创建人姓名"`
|
|
|
+ CreateTime string `description:"创建时间"`
|
|
|
+ ModifyTime string `description:"更新时间"`
|
|
|
+ Nodes []*AiPredictModelFrameworkNodeItem `description:"框架节点" gorm:"-"`
|
|
|
+ Button AiPredictModelFrameworkItemButton `description:"操作按钮" gorm:"-"`
|
|
|
+}
|
|
|
+
|
|
|
+// AiPredictModelFrameworkItemButton 操作按钮
|
|
|
+type AiPredictModelFrameworkItemButton struct {
|
|
|
+ OpButton bool `description:"是否可编辑"`
|
|
|
+ DeleteButton bool `description:"是否可删除"`
|
|
|
+ MoveButton bool `description:"是否可移动"`
|
|
|
+}
|
|
|
+
|
|
|
+// FormatAiPredictModelFramework2Item 格式化框架信息
|
|
|
+func FormatAiPredictModelFramework2Item(origin *AiPredictModelFramework, nodes []*AiPredictModelFrameworkNodeItem) (item *AiPredictModelFrameworkItem) {
|
|
|
+ if origin == nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ item = new(AiPredictModelFrameworkItem)
|
|
|
+ item.AiPredictModelFrameworkId = origin.AiPredictModelFrameworkId
|
|
|
+ item.FrameworkCode = origin.FrameworkCode
|
|
|
+ item.FrameworkName = origin.FrameworkName
|
|
|
+ item.FrameworkImg = origin.FrameworkImg
|
|
|
+ item.FrameworkContent = origin.FrameworkContent
|
|
|
+ item.IsPublic = origin.IsPublic
|
|
|
+ item.PublicTime = utils.TimeTransferString(utils.FormatDateTime, origin.PublicTime)
|
|
|
+ item.Sort = origin.Sort
|
|
|
+ item.AdminId = origin.AdminId
|
|
|
+ item.AdminName = origin.AdminName
|
|
|
+ item.CreateTime = utils.TimeTransferString(utils.FormatDateTime, origin.CreateTime)
|
|
|
+ item.ModifyTime = utils.TimeTransferString(utils.FormatDateTime, origin.ModifyTime)
|
|
|
+ item.Nodes = nodes
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// AiPredictModelFrameworkPublicMenuItem 公开框架目录
|
|
|
+type AiPredictModelFrameworkPublicMenuItem struct {
|
|
|
+ AdminId int `description:"创建人ID"`
|
|
|
+ MenuName string `description:"目录名称"`
|
|
|
+ Frameworks []*AiPredictModelFrameworkItem `description:"框架列表"`
|
|
|
+}
|