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.

46 lines
1.9 KiB

package models
import (
"hr_server/overall"
"strings"
)
// 双职工
type AcademicTitle struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"`
Types string `json:"types" gorm:"column:types;type:varchar(255) unsigned;default:'';not null;comment:职称级别"`
Series string `json:"series" gorm:"column:series;type:varchar(255) unsigned;default:'';not null;comment:职称系列"`
Speciality string `json:"speciality" gorm:"column:speciality;type:varchar(255) unsigned;default:'';not null;comment:职称专业"`
Number string `json:"number" gorm:"column:number;type:varchar(255) unsigned;default:'';not null;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:人员唯一识别符"`
}
func (AcademicTitle *AcademicTitle) TableName() string {
return "academictitle"
}
// 编辑双职工内容
func (AcademicTitle *AcademicTitle) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&AcademicTitle).Where(whereMap).Updates(saveData).Error
return
}
// 获取双职工内容
func (cont *AcademicTitle) 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 *AcademicTitle) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
return
}