query.go 480 B

123456789101112131415161718
  1. package yb_poster_resource
  2. import (
  3. "hongze/hongze_yb/global"
  4. )
  5. func (item *YbPosterResource) Create() (err error) {
  6. err = global.DEFAULT_MYSQL.Create(item).Error
  7. return
  8. }
  9. // GetPosterByCondition 获取海报
  10. func GetPosterByCondition(path, resourceType, version string) (item *YbPosterResource, err error) {
  11. err = global.DEFAULT_MYSQL.Model(YbPosterResource{}).
  12. Where("path = ? AND type = ? AND version = ?", path, resourceType, version).
  13. First(&item).Error
  14. return
  15. }