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.
60 lines
2.3 KiB
60 lines
2.3 KiB
|
2 years ago
|
package hrmodels
|
||
|
|
|
||
|
|
import (
|
||
|
|
"hr_server/overall"
|
||
|
|
"strings"
|
||
|
|
)
|
||
|
|
|
||
|
|
// 学历结构
|
||
|
|
type EducationalStructure struct {
|
||
|
|
Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;comment:员工工号"`
|
||
|
|
Education int `json:"education" gorm:"column:education;type:int(5) unsigned;default:1;comment:学历(1:初中及以下;2:中专;3:高中;4:中技;5:高技;6:函数专科;7:大学专科;8:函数本科;9:大学本科;10:硕士研究生;11:博士研究生;12:专家、教授)"`
|
||
|
|
AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"`
|
||
|
|
EducationMax int `json:"educationmax" gorm:"column:educationmax;type:int(5) unsigned;default:1;comment:学历(1:初中及以下;2:中专;3:高中;4:中技;5:高技;6:函数专科;7:大学专科;8:函数本科;9:大学本科;10:硕士研究生;11:博士研究生;12:专家、教授)"`
|
||
|
|
}
|
||
|
|
|
||
|
|
func (EducationalStructure *EducationalStructure) TableName() string {
|
||
|
|
return "educational_structure"
|
||
|
|
}
|
||
|
|
|
||
|
|
// 编辑内容
|
||
|
|
func (cont *EducationalStructure) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
||
|
|
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
// 获取内容
|
||
|
|
func (cont *EducationalStructure) 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 *EducationalStructure) CountCont(whereMap interface{}) (countId int64) {
|
||
|
|
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
// 读取全部信息
|
||
|
|
func (cont *EducationalStructure) ContMap(whereMap interface{}, field ...string) (countAry []EducationalStructure, err error) {
|
||
|
|
gormDb := overall.CONSTANT_DB_HR.Model(&cont)
|
||
|
|
if len(field) > 0 {
|
||
|
|
fieldStr := strings.Join(field, ",")
|
||
|
|
gormDb = gormDb.Select(fieldStr)
|
||
|
|
}
|
||
|
|
err = gormDb.Where(whereMap).Find(&countAry).Error
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
// 删除内容
|
||
|
|
func (cont *EducationalStructure) DelCont(whereMap interface{}) (err error) {
|
||
|
|
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
|
||
|
|
return
|
||
|
|
}
|