Pārlūkot izejas kodu

add 查询动态数据

tags/v0.0.2
shenjiachi pirms 1 nedēļas
vecāks
revīzija
0a49428505
2 mainītis faili ar 24 papildinājumiem un 0 dzēšanām
  1. +3
    -0
      src/dao/egg_energy_available_energy_flow_dao.go
  2. +21
    -0
      src/implement/egg_energy_available_energy_flow_implement.go

+ 3
- 0
src/dao/egg_energy_available_energy_flow_dao.go Parādīt failu

@@ -1,5 +1,8 @@
package dao

import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type EggEnergyAvailableEnergyFlowDao interface {
//TODO:: You can add specific method definitions here
EggEnergyAvailableEnergyFlowFindAndCount(kind, page, pageSize int, startAt, endAt string) ([]*model.EggEnergyAvailableEnergyFlow, int64, error)
}

+ 21
- 0
src/implement/egg_energy_available_energy_flow_implement.go Parādīt failu

@@ -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
}

Notiek ielāde…
Atcelt
Saglabāt