package modelshr import ( "appPlatform/overall" "strings" ) type UserPostDuties struct { Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:ID"` Number string `json:"number" gorm:"column:number;type:varchar(30) unsigned;not null;comment:员工工号"` Name string `json:"name" gorm:"column:name;type:varchar(255) unsigned;default:'';not null;comment:姓名"` Icon string `json:"icon" gorm:"column:icon;type:varchar(255) unsigned;default:'';not null;comment:头像"` Company int64 `json:"company" gorm:"column:company;type:bigint(20) unsigned;default:0;not null;comment:入职公司"` MainDeparment int64 `json:"maindeparment" gorm:"column:maindeparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` AdminOrg int64 `json:"adminorg" gorm:"column:admin_org;type:bigint(20) unsigned;default:0;not null;comment:所属行政组织"` TeamId int64 `json:"teamid" gorm:"column:teamid;type:bigint(20) unsigned;default:0;not null;comment:班组"` Position int64 `json:"position" gorm:"column:position;type:bigint(20) unsigned;default:0;not null;comment:职位"` JobId int64 `json:"jobid" gorm:"column:job_id;type:bigint(20) unsigned;default:0;not null;comment:职务"` JobLeve int64 `json:"jobleve" gorm:"column:job_leve;type:bigint(20) unsigned;default:0;not null;comment:职务等级"` Wechat string `json:"wechat" gorm:"column:wechat;type:varchar(255) unsigned;default:'';not null;comment:微信UserId"` WorkWechat string `json:"workwechat" gorm:"column:work_wechat;type:varchar(255) unsigned;default:'';not null;comment:企业微信UserId"` Key int64 `json:"key" gorm:"column:key;type:bigint(50) unsigned;default:0;not null;comment:key"` IsAdmin int `json:"isadmin" gorm:"column:is_admin;type:tinyint(1) unsigned;default:1;not null;comment:是否为管理员(1:不是;2:分公司;3:集团管理员;4:超级管` Password string `json:"password" gorm:"column:password;type:varchar(255) unsigned;default:'';not null;comment:密码"` Role string `json:"role" gorm:"column:role;type:longtext;comment:角色"` SunMainDeparment int64 `json:"sunmaindeparment" gorm:"column:sun_main_deparment;type:bigint(20) unsigned;default:0;not null;comment:主部门"` Mobilephone string `json:"mobilephone" gorm:"column:mobilephone;type:varchar(50) unsigned;default:'';not null;comment:手机号码"` Gender int `json:"gender" gorm:"column:gender;type:tinyint(1) unsigned;default:1;not null;comment:性别(1:男性;2:女性;3:中性)"` PostName string `json:"postname" gorm:"column:postname;type:varchar(255) unsigned;default:'';not null;comment:职位名称"` PersonInCharge int `json:"personincharge" gorm:"column:leading_cadre;type:int(1) unsigned;default:2;not null;comment:是否为本部门负责人(1:是;2:否)"` Superior int64 `json:"superior" gorm:"column:post_superior;type:bigint(20) unsigned;default:0;not null;comment:上级ID"` MenuPermit string `json:"menupermit" gorm:"column:menu_permit;type:longtext;comment:菜单许可证"` ButtonPermit string `json:"buttonpermit" gorm:"column:button_permit;type:longtext;comment:按钮许可"` DutiesName string `json:"dutiesname" gorm:"column:duties_name;type:varchar(255) unsigned;default:'';not null;comment:职务名称"` } func (UserPostDuties *UserPostDuties) TableName() string { return "user_post_duties" } // 编辑内容 func (cont *UserPostDuties) EiteCont(whereMap interface{}, saveData interface{}) (err error) { err = overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Updates(saveData).Error return } // 获取内容 func (cont *UserPostDuties) 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 *UserPostDuties) CountCont(whereMap interface{}) (countId int64) { overall.CONSTANT_DB_HR.Model(&cont).Where(whereMap).Count(&countId) return } // 读取全部信息 func (cont *UserPostDuties) ContMap(whereMap interface{}, field ...string) (countAry []UserPostDuties, 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 *UserPostDuties) DelCont(whereMap interface{}) (err error) { err = overall.CONSTANT_DB_HR.Where(whereMap).Delete(&cont).Error return }