Dockerfile
This commit is contained in:
62
consts/stock/capacity_unit_volume.go
Normal file
62
consts/stock/capacity_unit_volume.go
Normal file
@@ -0,0 +1,62 @@
|
||||
package stock
|
||||
|
||||
// CapacityUnitVolume 体积单位枚举
|
||||
type CapacityUnitVolume string
|
||||
|
||||
const (
|
||||
CapacityUnitVolumeCBM CapacityUnitVolume = "CBM" // 立方米
|
||||
CapacityUnitVolumeM3 CapacityUnitVolume = "M3" // 立方米
|
||||
CapacityUnitVolumeL CapacityUnitVolume = "L" // 升
|
||||
CapacityUnitVolumeML CapacityUnitVolume = "ML" // 毫升
|
||||
CapacityUnitVolumeGAL CapacityUnitVolume = "GAL" // 加仑
|
||||
)
|
||||
|
||||
// GetAllCapacityUnitVolumes 获取所有体积单位
|
||||
func GetAllCapacityUnitVolumes() []CapacityUnitVolume {
|
||||
return []CapacityUnitVolume{
|
||||
CapacityUnitVolumeCBM,
|
||||
CapacityUnitVolumeM3,
|
||||
CapacityUnitVolumeL,
|
||||
CapacityUnitVolumeML,
|
||||
CapacityUnitVolumeGAL,
|
||||
}
|
||||
}
|
||||
|
||||
type CapacityUnitVolumeKeyValue struct {
|
||||
Key CapacityUnitVolume
|
||||
Value string
|
||||
}
|
||||
|
||||
var (
|
||||
CapacityUnitVolumeCBMKeyValue = CapacityUnitVolumeKeyValue{Key: CapacityUnitVolumeCBM, Value: "立方米"}
|
||||
CapacityUnitVolumeM3KeyValue = CapacityUnitVolumeKeyValue{Key: CapacityUnitVolumeM3, Value: "立方米"}
|
||||
CapacityUnitVolumeLKeyValue = CapacityUnitVolumeKeyValue{Key: CapacityUnitVolumeL, Value: "升"}
|
||||
CapacityUnitVolumeMLKeyValue = CapacityUnitVolumeKeyValue{Key: CapacityUnitVolumeML, Value: "毫升"}
|
||||
CapacityUnitVolumeGALKeyValue = CapacityUnitVolumeKeyValue{Key: CapacityUnitVolumeGAL, Value: "加仑"}
|
||||
)
|
||||
|
||||
func GetAllCapacityUnitVolumeKeyValue() []CapacityUnitVolumeKeyValue {
|
||||
return []CapacityUnitVolumeKeyValue{
|
||||
CapacityUnitVolumeCBMKeyValue,
|
||||
CapacityUnitVolumeM3KeyValue,
|
||||
CapacityUnitVolumeLKeyValue,
|
||||
CapacityUnitVolumeMLKeyValue,
|
||||
CapacityUnitVolumeGALKeyValue,
|
||||
}
|
||||
}
|
||||
|
||||
var capacityUnitVolumeValueMap = map[CapacityUnitVolume]string{
|
||||
CapacityUnitVolumeCBM: CapacityUnitVolumeCBMKeyValue.Value,
|
||||
CapacityUnitVolumeM3: CapacityUnitVolumeM3KeyValue.Value,
|
||||
CapacityUnitVolumeL: CapacityUnitVolumeLKeyValue.Value,
|
||||
CapacityUnitVolumeML: CapacityUnitVolumeMLKeyValue.Value,
|
||||
CapacityUnitVolumeGAL: CapacityUnitVolumeGALKeyValue.Value,
|
||||
}
|
||||
|
||||
func GetCapacityUnitVolumeValueByKey(key CapacityUnitVolume) (value string) {
|
||||
value, exists := capacityUnitVolumeValueMap[key]
|
||||
if !exists {
|
||||
value = "未知单位"
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user