Przeglądaj źródła

add 查询分红列表、社区长

tags/v0.0.2
shenjiachi 1 tydzień temu
rodzic
commit
096006feef
4 zmienionych plików z 50 dodań i 1 usunięć
  1. +1
    -0
      src/dao/egg_energy_community_dividends_dao.go
  2. +2
    -0
      src/dao/egg_energy_community_dividends_with_user_dao.go
  3. +23
    -0
      src/implement/egg_energy_community_dividends_implement.go
  4. +24
    -1
      src/implement/egg_energy_community_dividends_with_user_implement.go

+ 1
- 0
src/dao/egg_energy_community_dividends_dao.go Wyświetl plik

@@ -4,5 +4,6 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"

type EggEnergyCommunityDividendsDao interface {
//TODO:: You can add specific method definitions here
EggEnergyCommunityDividendsFindAndCount(page, limit int, startAt, endAt string, startNums, endNums int64) ([]*model.EggEnergyCommunityDividends, int64, error)
EggEnergyCommunityDividendsInsert(EggEnergyCommunityDividends *model.EggEnergyCommunityDividends) (int, error)
}

+ 2
- 0
src/dao/egg_energy_community_dividends_with_user_dao.go Wyświetl plik

@@ -5,4 +5,6 @@ import "code.fnuoos.com/EggPlanet/egg_models.git/src/model"
type EggEnergyCommunityDividendsWithUserDao interface {
//TODO:: You can add specific method definitions here
EggEnergyCommunityDividendsWithUserInsert(EggEnergyCommunityDividendsWithUser *model.EggEnergyCommunityDividendsWithUser) (int, error)
EggEnergyCommunityDividendsWithUserFindAndCount(page, limit int, uid int64) ([]*model.EggEnergyCommunityDividendsWithUser, int64, error)
EggEnergyCommunityDividendsWithUserExist(uid int64) (bool, error)
}

+ 23
- 0
src/implement/egg_energy_community_dividends_implement.go Wyświetl plik

@@ -3,6 +3,7 @@ package implement
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"
)

@@ -14,6 +15,28 @@ type EggEnergyCommunityDividendsDb struct {
Db *xorm.Engine
}

func (e EggEnergyCommunityDividendsDb) EggEnergyCommunityDividendsFindAndCount(page, limit int, startAt, endAt string, startNums, endNums int64) ([]*model.EggEnergyCommunityDividends, int64, error) {
var m []*model.EggEnergyCommunityDividends
session := e.Db.Where("")
if startAt != "" {
session = session.And("create_at > ?", startAt)
}
if endAt != "" {
session = session.And("create_at < ?", endAt)
}
if startNums != 0 {
session = session.And("nums > ?", startNums)
}
if endNums != 0 {
session = session.And("nums < ?", endNums)
}
total, err := session.Limit(limit, (page-1)*limit).FindAndCount(&m)
if err != nil {
return nil, 0, zhios_order_relate_logx.Error(err.Error())
}
return m, total, nil
}

func (e EggEnergyCommunityDividendsDb) EggEnergyCommunityDividendsInsert(EggEnergyCommunityDividends *model.EggEnergyCommunityDividends) (int, error) {
_, err := e.Db.InsertOne(EggEnergyCommunityDividends)
if err != nil {


+ 24
- 1
src/implement/egg_energy_community_dividends_with_user_implement.go Wyświetl plik

@@ -3,6 +3,7 @@ package implement
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"
)

@@ -17,7 +18,29 @@ type EggEnergyCommunityDividendsWithUserDb struct {
func (e EggEnergyCommunityDividendsWithUserDb) EggEnergyCommunityDividendsWithUserInsert(EggEnergyCommunityDividendsWithUser *model.EggEnergyCommunityDividendsWithUser) (int, error) {
_, err := e.Db.InsertOne(EggEnergyCommunityDividendsWithUser)
if err != nil {
return 0, err
return 0, zhios_order_relate_logx.Error(err.Error())
}
return EggEnergyCommunityDividendsWithUser.Id, nil
}

func (e EggEnergyCommunityDividendsWithUserDb) EggEnergyCommunityDividendsWithUserFindAndCount(page, limit int, uid int64) ([]*model.EggEnergyCommunityDividendsWithUser, int64, error) {
var m []*model.EggEnergyCommunityDividendsWithUser
session := e.Db.Where("")
if uid > 0 {
session = session.And("uid=?", uid)
}
total, err := session.Limit(limit, (page-1)*limit).FindAndCount(&m)
if err != nil {
return nil, 0, zhios_order_relate_logx.Error(err.Error())
}
return m, total, nil
}

func (e EggEnergyCommunityDividendsWithUserDb) EggEnergyCommunityDividendsWithUserExist(uid int64) (bool, error) {
var m model.EggEnergyCommunityDividendsWithUser
has, err := e.Db.Where("uid=?", uid).Exist(&m)
if err != nil {
return false, zhios_order_relate_logx.Error(err.Error())
}
return has, nil
}

Ładowanie…
Anuluj
Zapisz