base_from_ly_classify.go 1.1 KB

1234567891011121314151617181920212223242526
  1. // @Author gmy 2024/8/7 9:26:00
  2. package models
  3. import "github.com/beego/beego/v2/client/orm"
  4. type BaseFromLyClassify struct {
  5. BaseFromLyClassifyId int `orm:"column(base_from_ly_classify_id);pk"` // 分类ID
  6. CreateTime string `orm:"column(create_time)"` // 创建时间
  7. ModifyTime string `orm:"column(modify_time)"` // 修改时间
  8. ClassifyName string `orm:"column(classify_name)"` // 分类名称
  9. ParentId int `orm:"column(parent_id)"` // 上级id
  10. Sort int `orm:"column(sort)"` // 排序字段,越小越靠前
  11. ClassifyNameEn string `orm:"column(classify_name_en)"` // 英文分类名称
  12. }
  13. func init() {
  14. orm.RegisterModel(new(BaseFromLyClassify))
  15. }
  16. // GetLyClassifyByName 根据分类名称查询
  17. func GetLyClassifyByName(classifyName string) (item *BaseFromLyClassify, err error) {
  18. o := orm.NewOrmUsingDB("data")
  19. sql := `SELECT * FROM base_from_ly_classify WHERE classify_name=?`
  20. err = o.Raw(sql, classifyName).QueryRow(&item)
  21. return
  22. }