You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
9.3 KiB
161 lines
9.3 KiB
package archivesmodel
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/commonus"
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global"
|
|
)
|
|
|
|
//文档分类相关
|
|
type ArchivesType struct {
|
|
Id int64 `json:"id" gorm:"column:at_id;type:bigint(20) unsigned;not null;comment:Id"`
|
|
Title string `json:"title" gorm:"column:at_title;type:varchar(255);comment:档案分类名称"`
|
|
Stater int `json:"stater" gorm:"column:at_stater;type:tinyint(1) unsigned;default:1;not null;comment:档案分类状态"`
|
|
ParentId int64 `json:"parentId" gorm:"column:at_parent_id;type:bigint(20) unsigned;default:0;not null;comment:档案分类父级"`
|
|
Time int64 `json:"time" gorm:"column:at_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
|
|
UID int64 `json:"uid" gorm:"column:at_uid;type:bigint(20) unsigned;default:0;not null;comment:添加人员"`
|
|
Sort int `json:"sort" gorm:"column:at_sort;type:smallint(3) unsigned;default:50;not null;comment:排序"`
|
|
}
|
|
|
|
func (ArchivesType *ArchivesType) TableName() string {
|
|
return "archives_type"
|
|
}
|
|
|
|
//获取文档详细信息
|
|
func (a *ArchivesType) GetArchiveTypeInfo() (err error) {
|
|
err = global.GVA_DB_Master.Where("at_id = ?", a.Id).First(&a).Error
|
|
return
|
|
}
|
|
|
|
//文档列表
|
|
type ArchiveFile struct {
|
|
Id int64 `json:"id" gorm:"column:g_id;type:bigint(20) unsigned;not null;comment:Id"`
|
|
Title string `json:"title" gorm:"column:g_title;type:varchar(255);not null;comment:标题"`
|
|
Key string `json:"key" gorm:"column:g_key;type:varchar(255);default:null;comment:关键字"`
|
|
Describe string `json:"describe" gorm:"column:g_describe;type:mediumtext;comment:描述"`
|
|
Parent int64 `json:"parent" gorm:"column:g_parent;type:bigint(20) unsigned;default:0;not null;comment:父级"`
|
|
ParentSun int64 `json:"parentSun" gorm:"column:g_parent_sun;type:bigint(20) unsigned;default:0;not null;comment:分类"`
|
|
Source int `json:"source" gorm:"column:g_source;type:tinyint(1) unsigned;default:1;not null;comment:文档来源(1:原创;2:转载)"`
|
|
SourceUrl string `json:"sourceUrl" gorm:"column:g_source_url;type:varchar(255);default:null;comment:转载地址"`
|
|
Thumbnail string `json:"thumbnail" gorm:"column:g_thumbnail;type:varchar(255);default:null;comment:缩略图"`
|
|
Sort int64 `json:"sort" gorm:"column:g_sort;type:bigint(20) unsigned;default:50;not null;comment:排序"`
|
|
Comment int `json:"comment" gorm:"column:g_comment;type:tinyint(1) unsigned;default:1;not null;comment:评论设置(1:允许评论;2:禁止评论)"`
|
|
VisitStrat int `json:"visitStrat" gorm:"column:g_visit_strat;type:tinyint(1) unsigned;default:1;not null;comment:访问权限(1:公开;2:分厂;3:工段;4:自定义)"`
|
|
State int `json:"state" gorm:"column:g_state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:草稿;2:发表;3:下架;4:删除)"`
|
|
Time int64 `json:"time" gorm:"column:g_add_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
|
|
EiteTime int64 `json:"eiteTime" gorm:"column:g_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"`
|
|
UserKey int64 `json:"userKey" gorm:"column:g_user_key;type:bigint(20) unsigned;default:0;not null;comment:编辑人员"`
|
|
FactoryID int64 `json:"factoryId" gorm:"column:g_bf_id;type:bigint(20) unsigned;default:0;not null;comment:分厂"`
|
|
PositionID int64 `json:"positionId" gorm:"column:g_ws_id;type:bigint(20) unsigned;default:0;not null;comment:工段"`
|
|
TeamId int64 `json:"teamId" gorm:"column:g_team;type:bigint(20) unsigned;default:0;not null;comment:班组"`
|
|
DownloadState int `json:"downloadState" gorm:"column:g_download_state;type:tinyint(1) unsigned;default:1;not null;comment:是否允许下载(1:允许;2:禁止)"`
|
|
Read int64 `json:"read" gorm:"column:g_read;type:int(9) unsigned;default:0;not null;comment:阅读量"`
|
|
Discuss int64 `json:"discuss" gorm:"column:g_com_sum;type:int(9) unsigned;default:0;not null;comment:评论数"`
|
|
Collection int64 `json:"collection" gorm:"column:g_collection_sum;type:int(9) unsigned;default:0;not null;comment:收藏数"`
|
|
Likes int64 `json:"likes" gorm:"column:g_likes;type:int(9) unsigned;default:0;not null;comment:点赞数"`
|
|
Recommend int `json:"recommend" gorm:"column:g_recommend;type:tinyint(1) unsigned;default:2;not null;comment:推荐(1:推荐,2:不推荐)"`
|
|
Content string `json:"content" gorm:"column:g_content;type:longtext;comment:图文详情"`
|
|
StepOn int64 `json:"stepOn" gorm:"column:g_step_on;type:int(9) unsigned;default:0;not null;comment:踩数量"`
|
|
Ranges string `json:"ranges" gorm:"column:g_range;type:mediumtext;comment:自定义可见范围"`
|
|
WriteFactoryID int64 `json:"writeFactoryId" gorm:"column:g_write_bfid;type:bigint(20) 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:null;comment:物理地址"`
|
|
WriteGroup int64 `json:"writeGroup" gorm:"column:g_write_group;type:bigint(20) unsigned;default:3;not null;comment:写入人员组织"`
|
|
OuterLink string `json:"outerLink" gorm:"column:g_outer_link;type:varchar(255);default:'';comment:外部链接"`
|
|
}
|
|
|
|
func (ArchiveFile *ArchiveFile) TableName() string {
|
|
return "graphicform"
|
|
}
|
|
|
|
//初始化表单
|
|
func (a *ArchiveFile) InitInfo() {
|
|
a.Id = commonus.GetFileNumberEs()
|
|
a.Title = ""
|
|
a.Key = ""
|
|
a.Describe = ""
|
|
a.Parent = 0
|
|
a.ParentSun = 0
|
|
a.Source = 1
|
|
a.SourceUrl = ""
|
|
a.Thumbnail = ""
|
|
a.Sort = 50
|
|
a.Comment = 1
|
|
a.VisitStrat = 1
|
|
a.State = 2
|
|
a.Time = time.Now().Unix()
|
|
a.EiteTime = time.Now().Unix()
|
|
a.UserKey = 0
|
|
a.FactoryID = 0
|
|
a.PositionID = 0
|
|
a.TeamId = 0
|
|
a.DownloadState = 1
|
|
a.Read = 0
|
|
a.Discuss = 0
|
|
a.Collection = 0
|
|
a.Likes = 0
|
|
a.Recommend = 2
|
|
a.Content = ""
|
|
a.StepOn = 0
|
|
a.Ranges = ""
|
|
a.WriteFactoryID = 0
|
|
a.TextName = ""
|
|
a.TestUrl = ""
|
|
a.PhysicsPath = ""
|
|
a.WriteGroup = 3
|
|
a.OuterLink = ""
|
|
}
|
|
|
|
//获取文档详细信息
|
|
func (a *ArchiveFile) GetArchiveFileInfo() (err error) {
|
|
err = global.GVA_DB_BooImgkDate.Where("g_id = ?", a.Id).First(&a).Error
|
|
return
|
|
}
|
|
|
|
//文档属性
|
|
type BookAttribute struct {
|
|
Id int64 `json:"id" gorm:"column:b_id;type:bigint(20) unsigned;not null;autoIncrement;index;comment:Id"`
|
|
FileId int64 `json:"fileId" gorm:"column:b_file_id;type:bigint(20) unsigned;default:0;not null;comment:文档ID"`
|
|
UserId int64 `json:"userId" gorm:"column:b_userid;type:bigint(20) unsigned;default:0;not null;comment:阅读人ID"`
|
|
Time int64 `json:"time" gorm:"column:b_time;type:bigint(20) unsigned;default:0;not null;comment:阅读时间"`
|
|
Type int `json:"type" gorm:"column:b_type;type:tinyint(1) unsigned;default:1;not null;comment:类型 (1:阅读量;2:收藏数;3:赞;4:踩)"`
|
|
Stater int `json:"stater" gorm:"column:b_stater;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:有效;2:无效)"`
|
|
EiteTime int64 `json:"eiteTime" gorm:"column:b_eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`
|
|
Source int `json:"source" gorm:"column:b_source;type:tinyint(1) unsigned;default:1;not null;comment:来源(1:文档类;2:文档类评论;3:问题;4:问题答案;5:问题答案评论)"`
|
|
}
|
|
|
|
func (brchiveFile *BookAttribute) TableName() string {
|
|
return "bookattribute"
|
|
}
|
|
|
|
//获取文档详细信息
|
|
func (b *BookAttribute) GetBookAttributeInfo() (err error) {
|
|
err = global.GVA_DB_BooImgkDate.Where("b_id = ?", b.Id).First(&b).Error
|
|
return
|
|
}
|
|
|
|
//评论列表
|
|
type DiscussMsg struct {
|
|
Id int64 `json:"id" gorm:"column:dis_id;type:bigint(20) unsigned;not null;comment:Id"`
|
|
FileId int64 `json:"fileId" gorm:"column:dis_file_id;type:bigint(20) unsigned;default:0;not null;comment:文档ID"`
|
|
UserId int64 `json:"userId" gorm:"column:dis_user_id;type:bigint(20) unsigned;default:0;not null;comment:阅读人ID"`
|
|
Prent int64 `json:"prent" gorm:"column:dis_prent;type:bigint(20) unsigned;default:0;not null;comment:归属(0:评论源)"`
|
|
Content string `json:"cont" gorm:"column:dis_cont;type:text;comment:评论内容"`
|
|
Time int64 `json:"time" gorm:"column:dis_time;type:bigint(20) unsigned;default:0;not null;comment:时间"`
|
|
Stater int `json:"stater" gorm:"column:dis_stater;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:审核;2:发布;3:下架;4:删除)"`
|
|
Source int `json:"source" gorm:"column:dis_source;type:tinyint(1) unsigned;default:1;not null;comment:来源(1:文档类;2:文档类评论;3:问题;4:问题答案;5:问题答案评论)"`
|
|
UserJson string `json:"userJson" gorm:"column:dis_user_json;type:mediumtext;comment:评论人基本信息"`
|
|
EiteTime int64 `json:"eiteTime" gorm:"column:dis_eite_time;type:bigint(20) unsigned;default:0;not null;comment:修改时间"`
|
|
}
|
|
|
|
func (DiscussMsg *DiscussMsg) TableName() string {
|
|
return "discussmsg"
|
|
}
|
|
|
|
//获取文档详细信息
|
|
func (d *DiscussMsg) GetDiscussMsgInfo() (err error) {
|
|
err = global.GVA_DB_BooImgkDate.Where("b_id = ?", d.Id).First(&d).Error
|
|
return
|
|
}
|
|
|