edbdata_classify.go 1.2 KB

12345678910111213141516171819202122232425262728
  1. package eta_trial
  2. import (
  3. "hongze/hz_crm_eta/global"
  4. "time"
  5. )
  6. type EdbdataClassify struct {
  7. ClassifyId int `gorm:"primaryKey;column:classify_id;type:int(11);not null" json:"classify_id"`
  8. ClassifyName string `gorm:"index:idx_classify_name;column:classify_name;type:varchar(100);default:''" json:"classify_name"` // 分类名称
  9. ParentId int `gorm:"index:idx_parent_id;column:parent_id;type:int(11);default:0" json:"parent_id"` // 父级分类id
  10. CreateTime time.Time `gorm:"column:create_time;type:datetime" json:"create_time"`
  11. Sort int `gorm:"column:sort;type:int(11);default:0" json:"sort"` // 分类排序
  12. IsShow int `gorm:"column:is_show;type:tinyint(4);default:0" json:"is_show"` // 1:展示,0:不展示
  13. }
  14. func (m *EdbdataClassify) TableName() string {
  15. return "edbdata_classify"
  16. }
  17. func (m *EdbdataClassify) GetItemsByCondition(cond string, pars []interface{}, fieldArr []string, orderRule string) (items []*EdbdataClassify, err error) {
  18. order := `create_time DESC`
  19. if orderRule != "" {
  20. order = orderRule
  21. }
  22. err = global.MYSQL["edb_trial"].Where(cond, pars...).Order(order).Find(&items).Error
  23. return
  24. }