activity_permission.go 773 B

123456789101112131415161718192021222324
  1. package cygx
  2. import (
  3. "hongze/hz_crm_api/models/system"
  4. "strconv"
  5. "strings"
  6. )
  7. // GetAdminActivityPermission 活动查看权限SQL预处理
  8. func GetAdminActivityPermission(adminInfo *system.Admin, condition string) (conditionPermission string, err error) {
  9. adminList, err := system.GetAdminListByGroupId(adminInfo.GroupId)
  10. if err != nil {
  11. return
  12. }
  13. adminIdArr := make([]string, 0)
  14. for _, v := range adminList {
  15. adminIdArr = append(adminIdArr, strconv.Itoa(v.AdminId))
  16. }
  17. var adminidStr string
  18. adminidStr = strings.Join(adminIdArr, ",")
  19. conditionPermission = ` OR ( visible_range = 1 AND art.admin_id IN (` + adminidStr + `) ` + condition + `) `
  20. //conditionPermission += ` OR (art.activity_type_id = 7 AND visible_range != 1 ` + condition + `) `
  21. return
  22. }