package hrsystem import ( "strings" "gin_server_admin/global" ) // 员工档案(主) type PersonArchives struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` HireClass int `json:"hireclass" gorm:"column:hire_class;type:tinyint(1) unsigned;default:1;not null;comment:雇佣类型(1:雇佣入职;2:再入职;)"` EmpType int `json:"emptype" gorm:"column:emp_type;type:tinyint(1) unsigned;default:1;not null;comment:用工关系(1:实习生;2:待分配;3:试用员工;4:正式员工;5:停薪留职;6:退休;7:辞退;8:离职)"` Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` Deparment string `json:"deparment" gorm:"column:deparment;type:text;comment:部门"` AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` JobClass int64 `json:"jobclass" gorm:"column:job_class;type:bigint(20) unsigned;default:2;not null;comment:职务分类"` JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:写入时间"` EiteTime int64 `json:"eitetime" gorm:"column:eite_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` State int `json:"state" gorm:"column:state;type:tinyint(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)` Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` EmpTypeName string `json:"emptypename" gorm:"column:emp_type_name;type:varchar(255) unsigned;default:'';not null;comment:用工关系中文"` HireClassName string `json:"hireclassname" gorm:"column:hire_class_name;type:varchar(255) unsigned;default:'';not null;comment:雇佣类型中文"` SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` } func (PersonArchives *PersonArchives) TableName() string { return "person_archives" } // 编辑员工档案 func (PersonArchives *PersonArchives) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = global.GVA_DB_HrDataBase.Model(&PersonArchives).Where(whereMap).Updates(saveData).Error return } // 获取员工档案 func (cont *PersonArchives) GetCont(whereMap interface{}, field ...string) (err error) { gormDb := global.GVA_DB_HrDataBase.Model(&cont) if len(field) > 0 { fieldStr := strings.Join(field, ",") gormDb = gormDb.Select(fieldStr) } gormDb = gormDb.Where(whereMap) err = gormDb.First(&cont).Error return }