12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- package cygx
- import (
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- )
- type CygxInterviewApply struct {
- InterviewApplyId int `description:"访谈申请id"`
- UserId int `description:"用户id"`
- UserRealName string `description:"姓名"`
- Mobile string `description:"手机号"`
- CompanyId int `description:"公司id"`
- CompanyName string `description:"公司名称"`
- SalesRealName string `description:"所属销售"`
- Status string `description:"申请状态:默认:待邀请;'待访谈','已完成','已取消'"`
- InterviewTime string `description:"访谈时间"`
- CreateTime string `description:"申请时间"`
- ModifyTime string `description:"修改时间"`
- ArticleId int `description:"纪要id"`
- ArticleTitle string `description:"纪要标题"`
- ArticleIdMd5 string `description:"纪要id"`
- CategoryName string `description:"所属行业"`
- }
- type InterviewApplyListResp struct {
- Paging *paging.PagingItem
- List []*CygxInterviewApply
- }
- func GetInterviewApplyList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxInterviewApply, err error) {
- o := orm.NewOrm()
- sql := ` SELECT a.*,b.real_name AS user_real_name,b.mobile,b.email,c.company_name,c.seller_id,c.seller_name AS sales_real_name,c.industry_name,d.category_name
- FROM cygx_interview_apply AS a
- LEFT JOIN wx_user AS b ON a.user_id=b.user_id
- LEFT JOIN company_product AS c ON b.company_id=c.company_id
- LEFT JOIN cygx_article AS d on a.article_id=d.article_id
- WHERE 1=1 AND c.product_id=2 `
- if condition != "" {
- sql += condition
- }
- sql += ` ORDER BY a.create_time DESC LIMIT ?,? `
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
- return
- }
- func GetInterviewApplyListCount(condition string, pars []interface{}) (count int, err error) {
- o := orm.NewOrm()
- sql := `SELECT COUNT(1) AS count FROM cygx_interview_apply AS a
- INNER JOIN wx_user AS b ON a.user_id=b.user_id
- INNER JOIN company_product AS c ON b.company_id=c.company_id
- WHERE 1=1 AND c.product_id = 2 `
- if condition != "" {
- sql += condition
- }
- err = o.Raw(sql, pars).QueryRow(&count)
- return
- }
- func GetCygxInterviewApplyDetail(interviewApplyId int) (item *CygxInterviewApply, err error) {
- o := orm.NewOrm()
- sql := ` SELECT * FROM cygx_interview_apply WHERE interview_apply_id=? `
- err = o.Raw(sql, interviewApplyId).QueryRow(&item)
- return
- }
- //申请领取参数
- type InterviewApplyStatusReq struct {
- InterviewApplyId int `description:"访谈申请id"`
- InterviewTime string `description:"访谈时间"`
- HandleType int `description:"操作类型:1:更新,2:取消"`
- }
- func InterviewApplyStatusModify(interviewApplyId int, status, interviewTime string) (err error) {
- o := orm.NewOrm()
- sql := ``
- if interviewTime != "" {
- sql = `UPDATE cygx_interview_apply SET status=?,modify_time=NOW() ,interview_time=? WHERE interview_apply_id=? `
- _, err = o.Raw(sql, status, interviewTime, interviewApplyId).Exec()
- } else {
- sql = `UPDATE cygx_interview_apply SET status=?,modify_time=NOW() WHERE interview_apply_id=? `
- _, err = o.Raw(sql, status, interviewApplyId).Exec()
- }
- return
- }
|