package modelbookimg import ( "appPlatform/overall" "strings" ) // 图文信息表 type GraphicForm struct { Id int64 `json:"id" gorm:"primaryKey;column:g_id;type:bigint unsigned;not null;comment:ID"` Title string `json:"title" gorm:"column:g_title;type:varchar(255);comment:标题"` Key string `json:"key" gorm:"column:g_key;type:varchar(255);comment:关键字"` Describe string `json:"describe" gorm:"column:g_describe;type:mediumtext;comment:描述"` Parent int64 `json:"parent" gorm:"column:g_parent;type:bigint unsigned;not null;default:0;comment:父级"` ParentSun int64 `json:"parentsun" gorm:"column:g_parent_sun;type:bigint unsigned;not null;default:0;comment:父类"` Source int `json:"source" gorm:"column:g_source;type:tinyint unsigned;default:1;not null;comment:文档来源(1:原创;2:转载)"` SourceUrl string `json:"sourceurl" gorm:"column:g_source_url;type:varchar(255);comment:转载地址"` Thumbnail string `json:"thumbnail" gorm:"column:g_thumbnail;type:varchar(255);comment:缩略图"` Sort int64 `json:"sort" gorm:"column:g_sort;type:bigint unsigned;default:50;not null;comment:排序"` Comment int `json:"comment" gorm:"column:g_comment;type:tinyint unsigned;default:1;not null;comment:评论设置(1:允许评论;2:禁止评论)"` VisitStrat int `json:"visitstrat" gorm:"column:g_visit_strat;type:tinyint unsigned;default:1;not null;comment:访问权限(1:公开;2:分厂;3:工段;4:自定义)"` State int `json:"state" gorm:"column:g_state;type:tinyint unsigned;default:1;not null;comment:状态(1:草稿;2:发表;3:下架;4:删除)"` AddTime int64 `json:"addtime" gorm:"column:g_add_time;type:bigint unsigned;default:0;not null;comment:写入时间"` EiteTime int64 `json:"eite" gorm:"column:g_eite_time;type:bigint;not null;comment:修改时间"` UserKey int64 `json:"userkey" gorm:"column:g_user_key;type:bigint;comment:编辑人员"` BfId int64 `json:"bfid" gorm:"column:g_bf_id;type:bigint unsigned;default:0;not null;comment:分厂"` WsId int64 `json:"wsid" gorm:"column:g_ws_id;type:bigint unsigned;default:0;not null;comment:工段"` Team int64 `json:"team" gorm:"column:g_team;type:bigint unsigned;default:0;not null;comment:班组"` DownLoadState int `json:"downloadstate" gorm:"column:g_download_state;type:tinyint unsigned;default:1;not null;comment:是否允许下载(1:允许;2:禁止)"` Read int `json:"read" gorm:"column:g_read;type:int unsigned;default:0;not null;comment:阅读量"` ComSum int `json:"comsum" gorm:"column:g_com_sum;type:int unsigned;default:0;not null;comment:评论数"` CollectionSum int `json:"collectionsum" gorm:"column:g_collection_sum;type:int unsigned;default:0;not null;comment:收藏数"` Likes int `json:"likes" gorm:"column:g_likes;type:int unsigned;default:0;not null;comment:点赞数"` Recommend int `json:"recommend" gorm:"column:g_recommend;type:tinyint unsigned;default:2;not null;comment:推荐(1:推荐,2:不推荐)"` Content string `json:"content" gorm:"column:g_content;type:longtext;comment:图文详情"` StepOn int `json:"stepon" gorm:"column:g_step_on;type:int unsigned;default:0;not null;comment:踩数量"` Range string `json:"range" gorm:"column:g_range;type:mediumtext;comment:自定义可见范围"` WriteBfid string `json:"writebfid" gorm:"column:g_write_bfid;type:bigint unsigned;default:0;not null;comment:写入分厂"` TextName string `json:"textname" gorm:"column:g_text_name;type:varchar(255);default:'';comment:正文文档名称"` TestUrl string `json:"testurl" gorm:"column:g_test_url;type:varchar(255);default:'';comment:正文文档URL"` PhysicsPath string `json:"physicspath" gorm:"column:g_physics_path;type:varchar(255);default:'';comment:物理地址"` WriteGroup int64 `json:"writegroup" gorm:"column:g_write_group;type:bigint unsigned;default:3;not null;comment:写入人员组织"` OuterLink string `json:"outerlink" gorm:"column:g_outer_link;type:varchar(255);default:'';comment:外部链接"` } func (gf *GraphicForm) TableName() string { return "graphicform" } // 编辑图文信息内容 func (cont *GraphicForm) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_IMAGES_TEST.Model(&cont).Where(whereMap).Updates(saveData).Error return } // 获取图文信息内容 func (cont *GraphicForm) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_IMAGES_TEST.Model(&cont) if len(field) > 0 { fieldStr := strings.Join(field, ",") gormDb = gormDb.Select(fieldStr) } gormDb = gormDb.Where(whereMap) err = gormDb.First(&cont).Error return } // 删除内容 func (cont *GraphicForm) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_IMAGES_TEST.Where(whereMap).Delete(&cont).Error return }