package stock // WarehouseStatus 仓库状态枚举 type WarehouseStatus string const ( WarehouseStatusEnabled WarehouseStatus = "enable" // 启用 WarehouseStatusDisabled WarehouseStatus = "disable" // 停用 ) // GetAllWarehouseStatuses 获取所有仓库状态 func GetAllWarehouseStatuses() []WarehouseStatus { return []WarehouseStatus{ WarehouseStatusEnabled, WarehouseStatusDisabled, } } type WarehouseStatusKeyValue struct { Key WarehouseStatus Value string } var ( WarehouseStatusEnabledKeyValue = WarehouseStatusKeyValue{Key: WarehouseStatusEnabled, Value: "启用"} WarehouseStatusDisabledKeyValue = WarehouseStatusKeyValue{Key: WarehouseStatusDisabled, Value: "停用"} ) func GetAllWarehouseStatusKeyValue() []WarehouseStatusKeyValue { return []WarehouseStatusKeyValue{ WarehouseStatusEnabledKeyValue, WarehouseStatusDisabledKeyValue, } } var warehouseStatusValueMap = map[WarehouseStatus]string{ WarehouseStatusEnabled: WarehouseStatusEnabledKeyValue.Value, WarehouseStatusDisabled: WarehouseStatusDisabledKeyValue.Value, } func GetWarehouseStatusValueByKey(key WarehouseStatus) (value string) { value, exists := warehouseStatusValueMap[key] if !exists { value = "未知状态" } return }