article_interview_apply.go 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxInterviewApply struct {
  7. InterviewApplyId int `orm:"column(interview_apply_id);pk"`
  8. UserId int `description:"用户id"`
  9. CompanyId int `description:"客户id"`
  10. Status string `description:"'待邀请','待访谈','已完成','已取消'"`
  11. InterviewTime time.Time `description:"访谈时间"`
  12. ArticleId int `description:"纪要id"`
  13. Sort int `description:"排序"`
  14. ArticleTitle string `description:"纪要标题"`
  15. CreateTime time.Time `description:"创建时间"`
  16. ModifyTime time.Time `description:"修改时间"`
  17. ArticleIdMd5 string `description:"纪要id"`
  18. }
  19. //添加申请访谈信息
  20. func AddCygxInterviewApply(item *CygxInterviewApply) (lastId int64, err error) {
  21. o := orm.NewOrm()
  22. lastId, err = o.Insert(item)
  23. return
  24. }
  25. type ArticleInterviewApplyReq struct {
  26. ArticleId int `description:"报告id"`
  27. }
  28. type ArticleInterviewApplyResp struct {
  29. Status int `description:"1:申请成功,2:取消申请"`
  30. }
  31. func RemoveArticleInterviewApply(userId, articleId int) (err error) {
  32. o := orm.NewOrm()
  33. sql := `DELETE FROM cygx_interview_apply WHERE user_id=? AND article_id=? AND status<>'已取消' `
  34. _, err = o.Raw(sql, userId, articleId).Exec()
  35. return
  36. }
  37. func GetArticleInterviewApplyUsersCount(articleId int) (count int, err error) {
  38. sql := `SELECT COUNT(user_id) AS count FROM cygx_interview_apply WHERE article_id=? `
  39. err = orm.NewOrm().Raw(sql, articleId).QueryRow(&count)
  40. return
  41. }
  42. func GetArticleInterviewApply(userId, articleId int) (item *CygxInterviewApply, err error) {
  43. sql := `SELECT * FROM cygx_interview_apply WHERE user_id=? AND article_id=? AND status<>'已取消' `
  44. err = orm.NewOrm().Raw(sql, userId, articleId).QueryRow(&item)
  45. return
  46. }
  47. func GetArticleInterviewApplyCount(userId, articleId int) (count int, err error) {
  48. sql := `SELECT COUNT(1) AS count FROM cygx_interview_apply WHERE user_id=? AND article_id=? AND status<>'已取消' `
  49. err = orm.NewOrm().Raw(sql, userId, articleId).QueryRow(&count)
  50. return
  51. }
  52. type ArticleInterviewApplyList struct {
  53. Id int `orm:"column(id);pk"`
  54. ArticleId int
  55. UserId int
  56. CreateTime string
  57. Title string `description:"标题"`
  58. TitleEn string `description:"英文标题 "`
  59. UpdateFrequency string `description:"更新周期"`
  60. CreateDate string `description:"创建时间"`
  61. PublishDate string `description:"发布时间"`
  62. Body string `description:"内容"`
  63. Abstract string `description:"摘要"`
  64. CategoryName string `description:"一级分类"`
  65. SubCategoryName string `description:"二级分类"`
  66. Status string `description:"'待邀请','待访谈','已完成','已取消'"`
  67. InterviewTime string `description:"访谈时间"`
  68. ExpertBackground string `description:"专家背景"`
  69. ExpertNumber string `description:"专家编号"`
  70. }