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.

53 lines
2.2 KiB

package models
import (
"hr_server/overall"
"strings"
)
// 班组
type TalentInventory struct {
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"`
UserKey int64 `json:"userKey" gorm:"column:userKey;type:bigint(20) unsigned;default:0;not null;comment:归属人员key"`
UserTypes string `json:"userTypes" gorm:"column:userTypes;type:mediumtext;default null;comment:人员类型"`
CareerPlanning string `json:"careerPlanning" gorm:"column:careerPlanning;type:mediumtext;default null;comment:职业生涯规划"`
PersonalAssistance string `json:"personalAssistance" gorm:"column:personalAssistance;type:mediumtext;default null;comment:个人期望从组织获得的帮助"`
LastYearAssessmentLevel string `json:"lastYearAssessmentLevel" gorm:"column:lastYearAssessmentLevel;type:varchar(50) unsigned;default:'';not null;comment:上一年绩效成绩"`
Years int `json:"years" gorm:"column:years;type:int(5) unsigned;default:0;not null;comment:年份"`
Times int64 `json:"times" gorm:"column:times;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"`
}
func (TalentInventory *TalentInventory) TableName() string {
return "talentInventory"
}
// 编辑班组内容
func (TalentInventory *TalentInventory) EiteTalentInventoryCont(whereMap map[string]interface{}, saveData map[string]interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Model(&TalentInventory).Where(whereMap).Updates(saveData).Error
return
}
// 获取详细内容
func (cont *TalentInventory) 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 *TalentInventory) CountCont(whereMap interface{}) (countId int64) {
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
return
}
// 删除内容
func (cont *TalentInventory) DelCont(whereMap interface{}) (err error) {
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
return
}