common.go 657 字节
package service

type CommonService struct {
}

// 创建菜单服务
func (commonService *CommonService) DictionarySearch(codes []string) (interface{}, error) {
	type dictItem struct {
		ItemCode  string `json:"itemCode"`
		ItemValue string `json:"itemValue"`
	}
	dictionaries := make([]interface{}, 0)
	for i := range codes {
		switch codes[i] {
		case "MenuType":
			dictionaries = append(dictionaries, map[string]interface{}{
				"dictName": "菜单类型",
				"dictItems": []dictItem{
					{"目录", "catalog"},
					{"菜单", "menu"},
					{"按钮", "button"},
				},
			})
		}
	}
	return map[string]interface{}{"dictionary": dictionaries}, nil
}