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.
63 lines
2.8 KiB
63 lines
2.8 KiB
package models
|
|
|
|
import (
|
|
"hr_server/overall"
|
|
"strings"
|
|
)
|
|
|
|
type PoliticalIdentity struct {
|
|
Userkey int64 `json:"userkey" gorm:"primaryKey;column:userkey;type:bigint(20) unsigned;not null;comment:员工唯一识别符;"`
|
|
PoliticalOutlook int `json:"politicaloutlook" gorm:"column:political_outlook;type:int(3) unsigned;default:1;comment:政治面貌(1:群众;2:无党派;3:台盟会员;4:九三社员;5:致公党员;6:农工党员;7:民进会员;8:民建会员;9:民盟盟员;10:民革会员,11:共青团员;12:预备党员;13:中共党员)"`
|
|
JoinTime int64 `json:"joinTime" gorm:"column:joinTime;type:bigint(20) unsigned;default:0;not null;comment:加入时间"`
|
|
Branch string `json:"branch" gorm:"column:branch;type:varchar(255) ;comment:所在党支部"`
|
|
Bosition string `json:"position" gorm:"column:position;type:varchar(255) ;comment:党内职务"`
|
|
JoiningParty string `json:"joiningParty" gorm:"column:joiningParty;type:varchar(255) ;comment:入党时所在单位"`
|
|
SwitchToClass int `json:"switchToClass" gorm:"column:switchToClass;type:int(1) unsigned;default:50;not null;comment:组织关系是否转入(1:是;2:否)"`
|
|
SwitchToTime int64 `json:"switchToTime" gorm:"column:switchToTime;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:创建时间"`
|
|
}
|
|
|
|
func (PoliticalIdentity *PoliticalIdentity) TableName() string {
|
|
return "political_identity"
|
|
}
|
|
|
|
// 编辑内容
|
|
func (cont *PoliticalIdentity) EiteCont(whereMap interface{}, saveData interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error
|
|
return
|
|
}
|
|
|
|
// 获取内容
|
|
func (cont *PoliticalIdentity) 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 *PoliticalIdentity) CountCont(whereMap interface{}) (countId int64) {
|
|
overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId)
|
|
return
|
|
}
|
|
|
|
// 读取全部信息
|
|
func (cont *PoliticalIdentity) ContMap(whereMap interface{}, field ...string) (countAry []PoliticalIdentity, 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 *PoliticalIdentity) DelCont(whereMap interface{}) (err error) {
|
|
err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error
|
|
return
|
|
}
|
|
|