interview_apply.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.NewOrmUsingDB("hz_cygx")
  29. sql := ` SELECT a.*,d.category_name
  30. FROM cygx_interview_apply AS a
  31. LEFT JOIN cygx_article AS d on a.article_id=d.article_id
  32. WHERE 1=1 `
  33. if condition != "" {
  34. sql += condition
  35. }
  36. sql += ` ORDER BY a.create_time DESC LIMIT ?,? `
  37. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  38. return
  39. }
  40. func GetInterviewApplyListCount(condition string, pars []interface{}) (count int, err error) {
  41. o := orm.NewOrmUsingDB("hz_cygx")
  42. sql := `SELECT COUNT(1) AS count FROM cygx_interview_apply AS a
  43. WHERE 1=1 `
  44. if condition != "" {
  45. sql += condition
  46. }
  47. err = o.Raw(sql, pars).QueryRow(&count)
  48. return
  49. }
  50. func GetCygxInterviewApplyDetail(interviewApplyId int) (item *CygxInterviewApply, err error) {
  51. o := orm.NewOrmUsingDB("hz_cygx")
  52. sql := ` SELECT * FROM cygx_interview_apply WHERE interview_apply_id=? `
  53. err = o.Raw(sql, interviewApplyId).QueryRow(&item)
  54. return
  55. }
  56. // 申请领取参数
  57. type InterviewApplyStatusReq struct {
  58. InterviewApplyId int `description:"访谈申请id"`
  59. InterviewTime string `description:"访谈时间"`
  60. HandleType int `description:"操作类型:1:更新,2:取消"`
  61. }
  62. func InterviewApplyStatusModify(interviewApplyId int, status, interviewTime string) (err error) {
  63. o := orm.NewOrmUsingDB("hz_cygx")
  64. sql := ``
  65. if interviewTime != "" {
  66. sql = `UPDATE cygx_interview_apply SET status=?,modify_time=NOW() ,interview_time=? WHERE interview_apply_id=? `
  67. _, err = o.Raw(sql, status, interviewTime, interviewApplyId).Exec()
  68. } else {
  69. sql = `UPDATE cygx_interview_apply SET status=?,modify_time=NOW() WHERE interview_apply_id=? `
  70. _, err = o.Raw(sql, status, interviewApplyId).Exec()
  71. }
  72. return
  73. }