|
|
@@ -2,6 +2,8 @@ |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
@@ -12,3 +14,22 @@ func NewEggEnergyAvailableEnergyFlowDb(engine *xorm.Engine) dao.EggEnergyAvailab |
|
|
|
type EggEnergyAvailableEnergyFlowDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyAvailableEnergyFlowDb) EggEnergyAvailableEnergyFlowFindAndCount(kind, page, pageSize int, startAt, endAt string) ([]*model.EggEnergyAvailableEnergyFlow, int64, error) { |
|
|
|
var m []*model.EggEnergyAvailableEnergyFlow |
|
|
|
session := e.Db.Where("") |
|
|
|
if kind > 0 { |
|
|
|
session = session.And("kind = ?", kind) |
|
|
|
} |
|
|
|
if startAt != "" { |
|
|
|
session = session.Where("create_time > ?", startAt) |
|
|
|
} |
|
|
|
if endAt != "" { |
|
|
|
session = session.Where("create_time < ?", endAt) |
|
|
|
} |
|
|
|
total, err := session.Limit(pageSize, (page-1)*pageSize).Desc("create_time").FindAndCount(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, 0, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
} |
|
|
|
return m, total, nil |
|
|
|
} |