package chart import ( "errors" "hongze/hongze_yb/models/tables/my_chart_classify" "hongze/hongze_yb/services/user" ) // GetUserChartClassifyListByCondition 获取用户图表分类列表 func GetUserChartClassifyListByCondition(userInfo user.UserInfo, publicCondition, privateCondition map[string]interface{}) (publicClassify, privateClassify []*my_chart_classify.MyChartClassify, err error) { // 判断是否为内部人员 isInner, adminInfo, err := user.GetAdminByUserInfo(userInfo) if err != nil { err = errors.New("用户信息有误, Err:" + err.Error()) return } if isInner { // 内部人员 publicCondition["is_public"] = 1 publicCondition["admin_id !="] = adminInfo.AdminID privateCondition["admin_id"] = adminInfo.AdminID privateClassify, err = my_chart_classify.GetClassifyListByCondition(privateCondition, "sort ASC, my_chart_classify_id ASC") if err != nil { err = errors.New("获取我的图表分类失败, Err:" + err.Error()) return } } else { // 用户 publicCondition["is_public"] = 1 publicCondition["is_company_public"] = 1 } publicClassify, err = my_chart_classify.GetClassifyListByCondition(publicCondition, "public_time ASC") if err != nil { err = errors.New("获取公共图表分类失败, Err:" + err.Error()) return } return }