productModel

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bill

type Bill struct {
	ProductKey Key `gorm:"primary_key;"`
	Encoding   constant.Encoding
	StartRow   int
	DateFormat string `gorm:"default:2006-01-02 15:04:05;"`
	commonModel.BaseModel
}

func (*Bill) IsEmpty

func (b *Bill) IsEmpty() bool

func (*Bill) SelectByPrimaryKey

func (b *Bill) SelectByPrimaryKey(key string) (*Bill, error)

func (*Bill) TableName

func (b *Bill) TableName() string

type BillHeader

type BillHeader struct {
	ID         uint
	ProductKey string `gorm:"not null;uniqueIndex:product_header_type,priority:1"`
	Name       string
	Type       BillHeaderType `gorm:"not null;uniqueIndex:product_header_type,priority:2"`
	commonModel.BaseModel
}

func (*BillHeader) GetNameMap

func (tc *BillHeader) GetNameMap(productKey string) (
	NameMap map[string]BillHeader, err error,
)

func (*BillHeader) IsEmpty

func (b *BillHeader) IsEmpty() bool

func (*BillHeader) TableName

func (b *BillHeader) TableName() string

type BillHeaderType

type BillHeaderType string
const (
	TransTime     BillHeaderType = "trans_time"
	TransCategory BillHeaderType = "trans_category"
	Remark        BillHeaderType = "remark"
	IncomeExpense BillHeaderType = "income_expense"
	Amount        BillHeaderType = "amount"
	OrderNumber   BillHeaderType = "order_number"
	TransStatus   BillHeaderType = "trans_status"
)

type Key

type Key string
const AliPay, WeChatPay Key = "AliPay", "WeChatPay"

type Product

type Product struct {
	Key    Key    `gorm:"primary_key"`
	Name   string `gorm:"comment:'名称'"`
	Hide   uint8  `gorm:"default:0;comment:'隐藏标识'"`
	Weight int    `gorm:"default:0;comment:'权重'"`
	commonModel.BaseModel
}

func (*Product) GetBill

func (p *Product) GetBill() (*Bill, error)

func (*Product) IsEmpty

func (p *Product) IsEmpty() bool

func (*Product) SelectByKey

func (p *Product) SelectByKey(key Key) (result Product, err error)

func (*Product) TableName

func (p *Product) TableName() string

type ProductDao

type ProductDao struct {
	// contains filtered or unexported fields
}

func NewDao

func NewDao(db ...*gorm.DB) *ProductDao

func (*ProductDao) GetBillHeaderList

func (pd *ProductDao) GetBillHeaderList(productKey Key) (list []BillHeader, err error)

func (*ProductDao) GetIncomeExpenseAndNameMap

func (pd *ProductDao) GetIncomeExpenseAndNameMap(productKey Key) (
	result map[constant.IncomeExpense]map[string]TransactionCategory, err error,
)

func (*ProductDao) GetPtcIdMapping

func (pd *ProductDao) GetPtcIdMapping(accountId uint, productKey Key) (
	result map[uint]TransactionCategoryMapping, err error,
)

func (*ProductDao) SelectAllCategoryMappingByCategoryId

func (pd *ProductDao) SelectAllCategoryMappingByCategoryId(categoryId uint) (
	result []TransactionCategoryMapping, err error,
)

func (*ProductDao) SelectBillByKey

func (pd *ProductDao) SelectBillByKey(key Key) (result Bill, err error)

func (*ProductDao) SelectByKey

func (pd *ProductDao) SelectByKey(key Key) (result Product, err error)

func (*ProductDao) SelectCategoryByName

func (pd *ProductDao) SelectCategoryByName(
	key Key, ie constant.IncomeExpense, name string,
) (result TransactionCategory, err error)

type TransactionCategory

type TransactionCategory struct {
	ID            uint                   `gorm:"primary_key"`
	ProductKey    string                 `gorm:"uniqueIndex:unique_name,priority:1"`
	IncomeExpense constant.IncomeExpense `gorm:"size:8;comment:'收支类型';uniqueIndex:unique_name,priority:2"`
	Name          string                 `gorm:"size:64;uniqueIndex:unique_name,priority:3"`
	commonModel.BaseModel
}

func (*TransactionCategory) GetIncomeExpenseAndNameMap

func (tc *TransactionCategory) GetIncomeExpenseAndNameMap(productKey Key) (
	result map[constant.IncomeExpense]map[string]TransactionCategory, err error,
)

func (*TransactionCategory) GetMap

func (tc *TransactionCategory) GetMap(productKey Key) (map[uint]TransactionCategory, error)

func (*TransactionCategory) IsEmpty

func (tc *TransactionCategory) IsEmpty() bool

func (*TransactionCategory) SelectById

func (tc *TransactionCategory) SelectById(id uint) error

func (*TransactionCategory) TableName

func (tc *TransactionCategory) TableName() string

type TransactionCategoryMapping

type TransactionCategoryMapping struct {
	AccountId  uint `gorm:"uniqueIndex:account_ptc_mapping,priority:1"`
	CategoryId uint `gorm:"uniqueIndex:category_ptc_mapping,priority:1"`
	PtcId      uint `gorm:"uniqueIndex:account_ptc_mapping,priority:2;uniqueIndex:category_ptc_mapping,priority:2"`
	ProductKey string
	CreatedAt  time.Time `gorm:"type:TIMESTAMP"`
	UpdatedAt  time.Time `gorm:"type:TIMESTAMP"`
	commonModel.BaseModel
}

func (*TransactionCategoryMapping) GetPtcIdMapping

func (tcm *TransactionCategoryMapping) GetPtcIdMapping(
	account *accountModel.Account, productKey Key,
) (result map[uint]TransactionCategoryMapping, err error)

func (*TransactionCategoryMapping) IsEmpty

func (tcm *TransactionCategoryMapping) IsEmpty() bool

func (*TransactionCategoryMapping) TableName

func (tcm *TransactionCategoryMapping) TableName() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL