interview_apply.go 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. )
  6. type CygxInterviewApply struct {
  7. InterviewApplyId int `description:"访谈申请id"`
  8. UserId int `description:"用户id"`
  9. UserRealName string `description:"姓名"`
  10. Mobile string `description:"手机号"`
  11. CompanyId int `description:"公司id"`
  12. CompanyName string `description:"公司名称"`
  13. SalesRealName string `description:"所属销售"`
  14. Status string `description:"申请状态:默认:待邀请;'待访谈','已完成','已取消'"`
  15. InterviewTime string `description:"访谈时间"`
  16. CreateTime string `description:"申请时间"`
  17. ModifyTime string `description:"修改时间"`
  18. ArticleId int `description:"纪要id"`
  19. ArticleTitle string `description:"纪要标题"`
  20. ArticleIdMd5 string `description:"纪要id"`
  21. CategoryName string `description:"所属行业"`
  22. }
  23. type InterviewApplyListResp struct {
  24. Paging *paging.PagingItem
  25. List []*CygxInterviewApply
  26. }
  27. func GetInterviewApplyList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxInterviewApply, err error) {
  28. o := orm.NewOrm()
  29. 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
  30. FROM cygx_interview_apply AS a
  31. LEFT JOIN wx_user AS b ON a.user_id=b.user_id
  32. LEFT JOIN company_product AS c ON b.company_id=c.company_id
  33. LEFT JOIN cygx_article AS d on a.article_id=d.article_id
  34. WHERE 1=1 AND c.product_id=2 `
  35. if condition != "" {
  36. sql += condition
  37. }
  38. sql += ` ORDER BY a.create_time DESC LIMIT ?,? `
  39. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  40. return
  41. }
  42. func GetInterviewApplyListCount(condition string, pars []interface{}) (count int, err error) {
  43. o := orm.NewOrm()
  44. sql := `SELECT COUNT(1) AS count FROM cygx_interview_apply AS a
  45. INNER JOIN wx_user AS b ON a.user_id=b.user_id
  46. INNER JOIN company_product AS c ON b.company_id=c.company_id
  47. WHERE 1=1 AND c.product_id = 2 `
  48. if condition != "" {
  49. sql += condition
  50. }
  51. err = o.Raw(sql, pars).QueryRow(&count)
  52. return
  53. }
  54. func GetCygxInterviewApplyDetail(interviewApplyId int) (item *CygxInterviewApply, err error) {
  55. o := orm.NewOrm()
  56. sql := ` SELECT * FROM cygx_interview_apply WHERE interview_apply_id=? `
  57. err = o.Raw(sql, interviewApplyId).QueryRow(&item)
  58. return
  59. }
  60. //申请领取参数
  61. type InterviewApplyStatusReq struct {
  62. InterviewApplyId int `description:"访谈申请id"`
  63. InterviewTime string `description:"访谈时间"`
  64. HandleType int `description:"操作类型:1:更新,2:取消"`
  65. }
  66. func InterviewApplyStatusModify(interviewApplyId int, status, interviewTime string) (err error) {
  67. o := orm.NewOrm()
  68. sql := ``
  69. if interviewTime != "" {
  70. sql = `UPDATE cygx_interview_apply SET status=?,modify_time=NOW() ,interview_time=? WHERE interview_apply_id=? `
  71. _, err = o.Raw(sql, status, interviewTime, interviewApplyId).Exec()
  72. } else {
  73. sql = `UPDATE cygx_interview_apply SET status=?,modify_time=NOW() WHERE interview_apply_id=? `
  74. _, err = o.Raw(sql, status, interviewApplyId).Exec()
  75. }
  76. return
  77. }