HR管理系统
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.

64 lines
3.3 KiB

package models
import (
"hr_server/overall"
"strings"
)
// 工作履历
type WorkHistory struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
Number string `json:"number" gorm:"column:number;type:varchar(50) unsigned;default:'';not null;comment:工号"`
Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:身份识别"`
Company string `json:"company" gorm:"column:company;type:varchar(255) unsigned;default:'';comment:公司"`
Deparment string `json:"deparment" gorm:"column:deparment;type:varchar(255) unsigned;default:'';comment:部门"`
Job string `json:"job" gorm:"column:job;type:varchar(255) unsigned;default:'';comment:职务"`
EntryTime int64 `json:"entrytime" gorm:"column:entry_time;type:bigint(20) unsigned;default:0;not null;comment:入职时间"`
Leavedate int64 `json:"leavedate" gorm:"column:leavedate;type:bigint(20) unsigned;default:0;not null;comment:离职日期"`
Witness string `json:"witness" gorm:"column:witness;type:varchar(255) unsigned;default:'';comment:证明人"`
WitnessTel string `json:"witnesstel" gorm:"column:witness_tel;type:varchar(255) unsigned;default:'';comment:证明人电话"`
Remarks string `json:"remarks" gorm:"column:remarks;type:text unsigned;default:'';comment:备注"`
Time int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"`
State int `json:"state" gorm:"column:state;type:int(1) unsigned;default:1;not null;comment:状态(1:启用;2:禁用;3:删除)"`
WorkCont string `json:"workcont" gorm:"column:workcont;type:longtext ;comment:工作内容"`
SuperiorPosition string `json:"superiorPosition" gorm:"column:superior_position;type:varchar(255) unsigned;default:'';comment:上级职务"`
8 months ago
MinionNumber int `json:"minion_number" gorm:"column:minion_number;type:int(5) unsigned;default:0;not null;comment:下属人数"`
CompanyNature string `json:"companyNature" gorm:"column:companyNature;type:varchar(255) unsigned;default:'';comment:公司性质"`
Industry string `json:"industry" gorm:"column:industry;type:varchar(255) unsigned;default:'';comment:所属行业"`
}
func (WorkHistory *WorkHistory) TableName() string {
return "work_history"
}
// 编辑职务分类内容
func (cont *WorkHistory) EiteCont(whereMap interface{}, saveData map[string]interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
return
}
// 获取行政组织内容
func (cont *WorkHistory) 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 *WorkHistory) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 删除内容
func (cont *WorkHistory) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
return
}