research_group.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package controllers
  2. import (
  3. "hongze/hz_crm_api/models"
  4. "hongze/hz_crm_api/services"
  5. )
  6. type ResearchGroupController struct {
  7. BaseAuthController
  8. }
  9. // GetResearchGroupList
  10. // @Title 获取研究方向分组列表
  11. // @Description 获取研究方向分组列表
  12. // @Success 200 {object} services.ResearchGroupItem 获取成功
  13. // @router /research_group/list [get]
  14. func (this *ResearchGroupController) GetResearchGroupList() {
  15. br := new(models.BaseResponse).Init()
  16. defer func() {
  17. this.Data["json"] = br
  18. this.ServeJSON()
  19. }()
  20. include, _ := this.GetInt("Include")
  21. list, err := services.GetResearchGroupTree(include)
  22. if err != nil {
  23. br.Msg = "获取分组失败"
  24. br.ErrMsg = "GetResearchGroupList ErrMsg:" + err.Error()
  25. return
  26. }
  27. br.Ret = 200
  28. br.Success = true
  29. br.Msg = "获取成功"
  30. br.Data = list
  31. }
  32. // GetAdminResearchGroup
  33. // @Title 获取研究员研究方向
  34. // @Description 获取研究员研究方向
  35. // @Param AdminId query int true "研究员ID"
  36. // @Success 200 {object} models.ResearchGroupRelation 获取成功
  37. // @router /research_group/admin_group [get]
  38. func (this *ResearchGroupController) GetAdminResearchGroup() {
  39. br := new(models.BaseResponse).Init()
  40. defer func() {
  41. this.Data["json"] = br
  42. this.ServeJSON()
  43. }()
  44. adminId, _ := this.GetInt("AdminId")
  45. if adminId == 0 {
  46. br.Msg = "参数有误"
  47. return
  48. }
  49. //list, err := system.ResearchGroupRelationListByAdminId(adminId)
  50. list, err := models.ResearchTagRelationListByAdminId(adminId)
  51. if err != nil {
  52. br.Msg = "获取研究方向失败"
  53. br.ErrMsg = "GetAdminResearchGroup ErrMsg:" + err.Error()
  54. return
  55. }
  56. br.Ret = 200
  57. br.Success = true
  58. br.Msg = "获取成功"
  59. br.Data = list
  60. }