1234567891011121314151617181920212223 |
- package banner
- import "hongze/hongze_yb/global"
- // GetBannerList
- func GetBannerList(cond string, page, limit int) (list []*Banner, err error) {
- err = global.DEFAULT_MYSQL.Where(cond).Limit(limit).Offset((page - 1) * limit).Find(&list).Error
- return
- }
- // GetBannerById
- func GetBannerById(id int) (item *Banner, err error) {
- err = global.DEFAULT_MYSQL.Where(" id=? ",id).First(&item).Error
- return
- }
- // GetBannerListCount
- func GetBannerListCount(cond string) (total int64, err error) {
- err = global.DEFAULT_MYSQL.Model(Banner{}).
- Where(cond).
- Count(&total).Error
- return
- }
|