package models import ( "hr_server/overall" "strings" ) // 班组 type TrainingLog struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` Insout int `json:"insout" gorm:"column:insout;type:int(1) unsigned;default:1;not null;comment:状内外(1:内部培训;2:外部培训)` Centont string `json:"centont" gorm:"column:centont;type:mediumtext;comment:班组名称"` Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` EditTime int64 `json:"editTime" gorm:"column:editTime;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` Userkey int64 `json:"userkey" gorm:"column:userkey;type:bigint(20) unsigned;default:0;not null;comment:userkey"` } func (TrainingLog *TrainingLog) TableName() string { return "trainingLog" } // 编辑班组内容 func (TrainingLog *TrainingLog) EiteTeamGroupCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&TrainingLog).Where(whereMap).Updates(saveData).Error return } // 获取详细内容 func (cont *TrainingLog) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := overall.CONSTANT_DB_HR.Model(&cont) if len(field) > 0 { fieldStr := strings.Join(field, ",") gormDb = gormDb.Select(fieldStr) } gormDb = gormDb.Where(whereMap) err = gormDb.First(&cont).Error return }