|
@@ -2,19 +2,25 @@ package models
|
|
|
|
|
|
import (
|
|
|
"eta_gn/eta_api/global"
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
type ImageConf struct {
|
|
|
ImageConfId int `gorm:"column:image_conf_id;primaryKey;autoIncrement:true"`
|
|
|
- CreateTime time.Time `gorm:"column:create_time" description:"消息时间"`
|
|
|
- ModifyTime time.Time `gorm:"column:modify_time" description:"更新时间"`
|
|
|
+ CreateTime time.Time `gorm:"column:create_time;autoCreateTime" description:"消息时间"`
|
|
|
+ ModifyTime time.Time `gorm:"column:modify_time;autoUpdateTime" description:"更新时间"`
|
|
|
ImageName string `gorm:"column:image_name;type:varchar(64);not null;default:''" description:"图片名称"`
|
|
|
Url string `gorm:"column:url;type:varchar(512);not null;default:''" description:"图片地址"`
|
|
|
ConfType int `gorm:"column:conf_type;type:tinyint(4) unsigned;not null;default:1" description:"配置类型 1-ppt素材"`
|
|
|
ImageType int `gorm:"column:image_type;type:tinyint(4) unsigned;not null;default:1" description:"图片类型 1-封面图 2-背景图 3-封底图"`
|
|
|
}
|
|
|
|
|
|
+type ImageConfPage struct {
|
|
|
+ List []*ImageConf
|
|
|
+ Paging *paging.PagingItem `description:"分页数据"`
|
|
|
+}
|
|
|
+
|
|
|
// BatchAddImageMaterials 新增图片素材
|
|
|
func BatchAddImageMaterials(items []*ImageConf, batchSize int) (err error) {
|
|
|
err = global.DmSQL["rddp"].CreateInBatches(items, batchSize).Error
|
|
@@ -36,3 +42,9 @@ func GetImageConfByCondition(condition string, pars []interface{}) (list []*Imag
|
|
|
err = global.DmSQL["rddp"].Where(condition, pars...).Find(&list).Error
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// GetImageConfByConditionCount 根据条件查询图片素材数量
|
|
|
+func GetImageConfByConditionCount(condition string, pars []interface{}) (count int64, err error) {
|
|
|
+ err = global.DmSQL["rddp"].Model(&ImageConf{}).Where(condition, pars...).Count(&count).Error
|
|
|
+ return
|
|
|
+}
|