package rcrt import ( "hongze/hrms_api/global" "hongze/hrms_api/models/base" "time" ) type OutCv struct { Id int64 `gorm:"primaryKey;column:id" json:"id"` CvId int64 `gorm:"column:cv_id" json:"cv_id"` //简历ID CvTitle string `gorm:"column:cv_title" json:"cv_title"` //简历标题 CvName string `gorm:"column:cv_name" json:"cv_name"` //求职者姓名 CvUrl string `gorm:"column:cv_url" json:"cv_url"` //简历地址 AdminId uint64 `gorm:"column:admin_id" json:"admin_id"` //设置淘汰的管理员账号 OutTime time.Time `gorm:"column:out_time" json:"out_time"` //淘汰时间 OutStage int8 `gorm:"column:out_stage" json:"out_stage"` //第几轮淘汰:1,2,3 CvFileName string `gorm:"column:cv_file_name" json:"cv_file_name"` //简历文件名 Position string `gorm:"column:position" json:"position"` //应聘职位 ProcessId int64 `gorm:"column:process_id" json:"process_id"` //流程ID ProcessStage int8 `gorm:"column:process_stage" json:"process_stage"` //流程进行到第几轮:0:无, 1:第一轮面试;2:第二轮面试;3:第三轮面试 Enabled int8 `gorm:"column:enabled" json:"enabled"` //是否启用,1:启用,0:禁用 base.TimeBase } // TableName get sql table name.获取数据库表名 func (c *OutCv) TableName() string { return "rcrt_out_cv" } type OutCvListTmpItem struct { OutCv AdminName string `json:"admin_name"` ReceiveTime time.Time `json:"receive_time"` //投递时间 } type OutCvListItem struct { Id int64 `json:"id"` CvId int64 `json:"cv_id"` //简历ID CvTitle string `json:"cv_title"` //简历标题 CvName string `json:"cv_name"` //求职者姓名 CvUrl string `json:"cv_url"` //简历地址 CvFileName string `json:"cv_file_name"` //简历文件名 Position string `json:"position"` //应聘职位 AdminId uint64 `json:"admin_id"` //设置淘汰的管理员账号 OutTime string `json:"out_time"` //淘汰时间 OutStage int8 `json:"out_stage"` //第几轮淘汰:0:(取消面试), 1,2,3,4, AdminName string `json:"admin_name"` CreateTime string `json:"create_time"` //创建时间 ModifyTime string `json:"modify_time"` //最后更新时间 ProcessStage int8 `json:"process_stage"` //流程进行到第几轮:0:无, 1:第一轮面试;2:第二轮面试;3:第三轮面试 } type OutCvListReq struct { OutTime string `json:"out_time" form:"out_time" binding:"omitempty,datetime=2006-01-02"` //淘汰时间 AdminId int64 `json:"admin_id" form:"admin_id"` //hr账号ID base.PageReq } type OutCvDelReq struct { Id int64 `json:"id" binding:"required,gte=1"` } func (c *OutCv) SelectPage(page base.IPage, condition string, pars []interface{}) (count int64, results []*OutCvListTmpItem, err error) { query := global.DEFAULT_MYSQL. Table("rcrt_out_cv as ov "). Select("ov.*, a.real_name as admin_name, cv.receive_time"). Joins("Left JOIN rcrt_cv cv ON cv.cv_id = ov.cv_id"). Joins("Left JOIN sys_admin a ON a.admin_id = ov.admin_id"). Where(condition, pars...) query.Count(&count) if len(page.GetOrderItemsString()) > 0 { query = query.Order(page.GetOrderItemsString()) } err = query.Limit(int(page.GetPageSize())).Offset(int(page.Offset())).Find(&results).Error return } type OutCvAdminItem struct { AdminId uint64 `json:"admin_id"` //账号id RealName string `json:"real_name"` //真实姓名 } func (c *OutCv) GetAdmins() (list []*OutCvAdminItem, err error) { err = global.DEFAULT_MYSQL.Model(c). Table("rcrt_out_cv as oc "). Select("distinct a.admin_id, a.real_name"). Joins("Left JOIN sys_admin a ON oc.admin_id = a.admin_id"). Where("a.enabled = 1"). Find(&list).Error return } // Add 新增 func (c *OutCv) Add() (err error) { err = global.DEFAULT_MYSQL.Create(c).Error return } // 修改 func (c *OutCv) Update(updateCols []string) (err error) { err = global.DEFAULT_MYSQL.Model(c).Select(updateCols).Updates(c).Error return } // 删除 func (c *OutCv) Delete() (err error) { err = global.DEFAULT_MYSQL.Delete(c).Error return } func (c *OutCv) GetOutCvById(id int64) (item *OutCv, err error) { err = global.DEFAULT_MYSQL.Model(c).Where("id = ? AND enabled = 1 ", id).First(&item).Error return } func (c *OutCv) GetOutCvByCvId(cvId int64) (item *OutCv, err error) { err = global.DEFAULT_MYSQL.Model(c).Where("cv_id = ? AND enabled = 1 ", cvId).First(&item).Error return } // OutCvResetReq 重置流程请求 type OutCvResetReq struct { CvId int64 `json:"cv_id"` //简历id Stage int8 `json:"stage" binding:"oneof=0 1 2 3"` //第几轮面试的确认操作:1,2,3 }