@@ -5,4 +5,5 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
type JpushNoticeDao interface { | type JpushNoticeDao interface { | ||||
GetJpushNotice(id string) (m *model.JpushNotice, err error) | GetJpushNotice(id string) (m *model.JpushNotice, err error) | ||||
FindJpushNotice(page, limit, types string) (*[]model.JpushNotice, error) | FindJpushNotice(page, limit, types string) (*[]model.JpushNotice, error) | ||||
FindJpushNoticeAndTotal(page, limit, types string) (*[]model.JpushNotice, int64, error) | |||||
} | } |
@@ -5,4 +5,5 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
type JpushRecordDao interface { | type JpushRecordDao interface { | ||||
GetJpushRecord(id string) (m *model.JpushRecord, err error) | GetJpushRecord(id string) (m *model.JpushRecord, err error) | ||||
FindJpushRecord(page, limit, title string) (*[]model.JpushRecord, error) | FindJpushRecord(page, limit, title string) (*[]model.JpushRecord, error) | ||||
FindJpushRecordAndTotal(page, limit, title string) (*[]model.JpushRecord, int64, error) | |||||
} | } |
@@ -40,3 +40,16 @@ func (j JpushNoticeDb) FindJpushNotice(page, limit, types string) (*[]model.Jpus | |||||
} | } | ||||
return &m, nil | return &m, nil | ||||
} | } | ||||
func (j JpushNoticeDb) FindJpushNoticeAndTotal(page, limit, types string) (*[]model.JpushNotice, int64, error) { | |||||
var m []model.JpushNotice | |||||
sess := j.Db.Where("1=1") | |||||
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) | |||||
if types != "" { | |||||
sess.In("type", strings.Split(types, ",")) | |||||
} | |||||
count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).FindAndCount(&m) | |||||
if err != nil { | |||||
return nil, count, zhios_order_relate_logx.Error(err) | |||||
} | |||||
return &m, count, nil | |||||
} |
@@ -39,3 +39,16 @@ func (j JpushRecordDb) FindJpushRecord(page, limit, title string) (*[]model.Jpus | |||||
} | } | ||||
return &m, nil | return &m, nil | ||||
} | } | ||||
func (j JpushRecordDb) FindJpushRecordAndTotal(page, limit, title string) (*[]model.JpushRecord, int64, error) { | |||||
var m []model.JpushRecord | |||||
sess := j.Db.Where("1=1") | |||||
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) | |||||
if title != "" { | |||||
sess.And("title like ?", "%"+title+"%") | |||||
} | |||||
count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).FindAndCount(&m) | |||||
if err != nil { | |||||
return nil, count, zhios_order_relate_logx.Error(err) | |||||
} | |||||
return &m, count, nil | |||||
} |