image_sources.go 895 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. func (i *ImageSource) TableName() string {
  7. return "image_sources"
  8. }
  9. type ImageSource struct {
  10. Id int ` description:"Id"`
  11. ImgName string `description:"图片名称"`
  12. SrcUrl string `description:"图片资源"`
  13. PermissionId int `description:"品种"`
  14. Deleted int `description:"是否删除"`
  15. CreatedTime time.Time `description:"创建时间"`
  16. UpdatedTime time.Time `description:"更新时间"`
  17. }
  18. func (i *ImageSource) Insert() (insertId int64, err error) {
  19. o := orm.NewOrm()
  20. insertId, err = o.Insert(i)
  21. return
  22. }
  23. func (i *ImageSource) Update() (err error) {
  24. o := orm.NewOrm()
  25. _, err = o.Update(i, "img_name", "src_url", "permission_id")
  26. return
  27. }
  28. func (i *ImageSource) Delete() (err error) {
  29. o := orm.NewOrm()
  30. _, err = o.Update(i, "deleted")
  31. return
  32. }