package models import ( "hr_server/overall" "strings" ) // 证书 type CertificateHonors struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` Title string `json:"title" gorm:"column:title;type:varchar(30) unsigned;not null;comment:证书/荣誉名称"` UserKey int64 `json:"userkey" gorm:"column:userkey;type:bigint(20) unsigned;default:0;not null;comment:获得人员"` Types int `json:"types" gorm:"column:types;type:tinyint(1) unsigned;default:1;not null;comment:类型(1:职称证书;2:资格证书;3:荣誉)` State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` IssuingUnit string `json:"issuingUnit" gorm:"column:issuing_unit;type:varchar(255) unsigned;default:'';not null;comment:颁发单位"` TimeData int64 `json:"timedata" gorm:"column:timedata;type:bigint(20) unsigned;default:0;not null;comment:获得时间"` Years int `json:"years" gorm:"column:years;type:int(7) unsigned;default:0;not null;comment:年"` Months int `json:"months" gorm:"column:months;type:int(7) unsigned;default:0;not null;comment:月"` Number string `json:"number" gorm:"column:number;type:varchar(255) unsigned;not null;comment:证书编号"` EndTime int64 `json:"endTime" gorm:"column:endTime;type:bigint(20) unsigned;default:0;not null;comment:截止时间"` ValidPeriod string `json:"validPeriod" gorm:"column:validPeriod;type:varchar(255) unsigned;not null;comment:有效期限"` } func (CertificateHonors *CertificateHonors) TableName() string { return "certificate_honors" } // 编辑双职工内容 func (CertificateHonors *CertificateHonors) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&CertificateHonors).Where(whereMap).Updates(saveData).Error return } // 获取双职工内容 func (cont *CertificateHonors) 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 } // 删除内容 func (cont *CertificateHonors) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error return }