优化mongo,封装count逻辑,处理objectId
This commit is contained in:
52
consts/payment_terms.go
Normal file
52
consts/payment_terms.go
Normal file
@@ -0,0 +1,52 @@
|
||||
package consts
|
||||
|
||||
// PaymentTerms 支付条款枚举
|
||||
type PaymentTerms string
|
||||
|
||||
const (
|
||||
PaymentTermsNet30 PaymentTerms = "net_30" // 30天
|
||||
PaymentTermsNet60 PaymentTerms = "net_60" // 60天
|
||||
PaymentTermsNet90 PaymentTerms = "net_90" // 90天
|
||||
)
|
||||
|
||||
// GetAllPaymentTerms 获取所有支付条款
|
||||
func GetAllPaymentTerms() []PaymentTerms {
|
||||
return []PaymentTerms{
|
||||
PaymentTermsNet30,
|
||||
PaymentTermsNet60,
|
||||
PaymentTermsNet90,
|
||||
}
|
||||
}
|
||||
|
||||
type PaymentTermsKeyValue struct {
|
||||
Key PaymentTerms
|
||||
Value string
|
||||
}
|
||||
|
||||
var (
|
||||
PaymentTermsNet30KeyValue = PaymentTermsKeyValue{Key: PaymentTermsNet30, Value: "30天"}
|
||||
PaymentTermsNet60KeyValue = PaymentTermsKeyValue{Key: PaymentTermsNet60, Value: "60天"}
|
||||
PaymentTermsNet90KeyValue = PaymentTermsKeyValue{Key: PaymentTermsNet90, Value: "90天"}
|
||||
)
|
||||
|
||||
func GetAllPaymentTermsKeyValue() []PaymentTermsKeyValue {
|
||||
return []PaymentTermsKeyValue{
|
||||
PaymentTermsNet30KeyValue,
|
||||
PaymentTermsNet60KeyValue,
|
||||
PaymentTermsNet90KeyValue,
|
||||
}
|
||||
}
|
||||
|
||||
var paymentTermsValueMap = map[PaymentTerms]string{
|
||||
PaymentTermsNet30: PaymentTermsNet30KeyValue.Value,
|
||||
PaymentTermsNet60: PaymentTermsNet60KeyValue.Value,
|
||||
PaymentTermsNet90: PaymentTermsNet90KeyValue.Value,
|
||||
}
|
||||
|
||||
func GetPaymentTermsValueByKey(key PaymentTerms) (value string) {
|
||||
value, exists := paymentTermsValueMap[key]
|
||||
if !exists {
|
||||
value = "未知支付条款"
|
||||
}
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user