package yb import ( "github.com/beego/beego/v2/client/orm" "time" ) const ( // 流程类型: 1-分配; 2-转移 ProcessTypeDistribute = 1 ProcessTypeTransfer = 2 ) // CommunityQuestionProcess 问答社区流程表 type CommunityQuestionProcess struct { Id int `orm:"column(id);pk" json:"-"` CommunityQuestionId int `json:"community_question_id"` TransferUserId int `json:"transfer_user_id"` TransferAdminId int `json:"transfer_admin_id"` TransferAdminName string `json:"transfer_admin_name"` ReplierUserId int `json:"replier_user_id"` ReplierAdminId int `json:"replier_admin_id"` ReplierAdminName string `json:"replier_admin_name"` Remark string `json:"remark"` ProcessType int `json:"process_type"` CreateTime time.Time `json:"create_time"` VarietyClassifyId int `json:"variety_classify_id"` VarietyTagId int `json:"variety_tag_id"` } func (item *CommunityQuestionProcess) TableName() string { return "yb_community_question_process" } func (item *CommunityQuestionProcess) Create() (err error) { o := orm.NewOrmUsingDB("weekly") id, err := o.Insert(item) if err != nil { return } item.Id = int(id) return } // CommunityQuestionProcessItem 问答社区流程 type CommunityQuestionProcessItem struct { CommunityQuestionId int TransferUserId int TransferAdminId int TransferAdminName string ReplierUserId int ReplierAdminId int ReplierAdminName string Remark string ProcessType int CreateTime string VarietyClassifyId int VarietyTagId int } // GetCommunityQuestionProcessItemList 根据问答ID获取流程 func GetCommunityQuestionProcessItemList(questionId int) (list []*CommunityQuestionProcessItem, err error) { list = make([]*CommunityQuestionProcessItem, 0) o := orm.NewOrmUsingDB("weekly") sql := `SELECT * FROM yb_community_question_process WHERE community_question_id = ? ORDER BY create_time DESC` _, err = o.Raw(sql, questionId).QueryRows(&list) return }