12345678910111213141516171819202122 |
- package dao
- // User 字典
- 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 Db.Model(&c).Where("code = ? and dict_key = ?", c.Code, c.DictKey).Find(&c).Error
- }
|