package models import ( "hr_server/overall" "strings" ) //职务信息及类别、等级视图 type DutiesClassLeve struct { Id int64 `json:"id" gorm:"primaryKey;column:d_id;type:bigint(20) unsigned;not null;comment:Id;index"` Name string `json:"name" gorm:"column:d_name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"` Weight int64 `json:"weight" gorm:"column:d_weight;type:bigint(20) unsigned;default:1;not null;comment:权重"` Number string `json:"number" gorm:"column:d_num;type:varchar(50) unsigned;default:'';not null;comment:编码"` State int `json:"state" gorm:"column:d_state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"` KingdeeId string `json:"kingdeeid" gorm:"column:d_king;type:varchar(255) unsigned;default:'';comment:金蝶对照ID"` ClassId int64 `json:"classid" gorm:"primaryKey;column:c_id;type:bigint(20) unsigned;not null;comment:Id;index"` //职务分类Id ClassName string `json:"classname" gorm:"column:c_name;type:varchar(255) unsigned;default:'';not null;comment:职务分类名称"` // LeveId int64 `json:"leveid" gorm:"primaryKey;column:l_id;type:bigint(20) unsigned;not null;comment:Id;index"` //职务等级Id // LeveNumber string `json:"levenumber" gorm:"column:l_num;type:varchar(50) unsigned;default:'';not null;comment:等级编号"` // LeveName string `json:"levename" gorm:"column:l_name;type:varchar(255) unsigned;default:'';not null;comment:等级名称"` } func (DutiesClassLeve *DutiesClassLeve) TableName() string { return "duties_class_leve" } //获取详细内容 func (cont *DutiesClassLeve) 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 }