12345678910111213141516171819202122 |
- package dao
- type Dict struct {
- ID int64 `gorm:"primary_key" json:"id"`
- ParentId int64 `gorm:"type:bigint;default 0" json:"parentId"`
- Code string `gorm:"type:varchar(255)" json:"code"`
- DictKey string `gorm:"type:varchar(255)" json:"dictKey"`
- DictValue string `gorm:"type:varchar(255)" json:"dictValue"`
- Sort int `gorm:"type:int" json:"sort"`
- Remark string `gorm:"type:varchar(255)" json:"remark"`
- IsSealed int `gorm:"type:int;default 0" json:"isSealed"`
- IsDeleted int `gorm:"type:int;default 0" json:"isDeleted"`
- }
- func (Dict) TableName() string {
- return "dict"
- }
- func (c *Dict) GetByCodeAndKey() error {
- return GDb.Model(&c).Where("code = ? and dict_key = ?", c.Code, c.DictKey).Find(&c).Error
- }
|