Преглед изворни кода

add 新增查询社区分红 新增查询免罚用户

tags/v0.0.2
shenjiachi пре 1 недеља
родитељ
комит
e32e67ba0c
10 измењених фајлова са 69 додато и 38 уклоњено
  1. +3
    -0
      src/dao/egg_energy_community_dividends_dao.go
  2. +3
    -0
      src/dao/egg_energy_community_dividends_with_user_dao.go
  3. +1
    -0
      src/dao/public_platoon_free_punish_with_user_dao.go
  4. +0
    -1
      src/dao/public_platoon_user_relation_dao.go
  5. +1
    -1
      src/dao/user_dao.go
  6. +9
    -0
      src/implement/egg_energy_community_dividends_implement.go
  7. +9
    -0
      src/implement/egg_energy_community_dividends_with_user_implement.go
  8. +24
    -0
      src/implement/public_platoon_free_punish_with_user_implement.go
  9. +0
    -36
      src/implement/public_platoon_user_relation_implement.go
  10. +19
    -0
      src/implement/user_implement.go

+ 3
- 0
src/dao/egg_energy_community_dividends_dao.go Прегледај датотеку

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

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

type EggEnergyCommunityDividendsDao interface {
//TODO:: You can add specific method definitions here
EggEnergyCommunityDividendsInsert(EggEnergyCommunityDividends *model.EggEnergyCommunityDividends) (int, error)
}

+ 3
- 0
src/dao/egg_energy_community_dividends_with_user_dao.go Прегледај датотеку

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

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

+ 1
- 0
src/dao/public_platoon_free_punish_with_user_dao.go Прегледај датотеку

@@ -9,4 +9,5 @@ type PublicPlatoonFreePunishWithUserDao interface {
FindAllPublicPlatoonFreePunishWithUser() (resp map[int64]*model.PublicPlatoonFreePunishWithUser, err error)
PublicPlatoonFreePunishWithUserInsert(PublicPlatoonFreePunishWithUser *model.PublicPlatoonFreePunishWithUser) (int, error)
PublicPlatoonFreePunishWithUserUpdate(Db *xorm.Engine, id interface{}, PublicPlatoonFreePunishWithUser *model.PublicPlatoonFreePunishWithUser, forceColums ...string) (int64, error)
PublicPlatoonFreePunishWithUserCountAndGetPageByParams(page int, limit int, params map[string]interface{}) ([]model.PublicPlatoonFreePunishWithUser, int64, error)
}

+ 0
- 1
src/dao/public_platoon_user_relation_dao.go Прегледај датотеку

@@ -13,6 +13,5 @@ type PublicPlatoonUserRelationDao interface {
PublicPlatoonUserRelationFindByPid(fatherUid int64, fatherName, positionName string) ([]model.PublicPlatoonUserRelation, error)
PublicPlatoonUserRelationFindCountByPosition(fatherUid int64, fatherName, positionName string, startPosition, endPosition int64) ([]model.PublicPlatoonUserRelation, int64, error)
PublicPlatoonUserRelationFindByParamsByPage(params map[string]interface{}, page, pageSize int) (*[]model.PublicPlatoonUserRelation, error)
PublicPlatoonUserRelationGetOneByUid(uid int64) (*model.PublicPlatoonUserRelation, error)
PublicPlatoonUserRelationGetOneByPosition(position int64) (*model.PublicPlatoonUserRelation, error)
}

+ 1
- 1
src/dao/user_dao.go Прегледај датотеку

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

type UserDao interface {
//TODO:: You can add specific method definitions here
UserGetOneByParams(params map[string]interface{}) (*model.User, error)
UserFindByParams(params map[string]interface{}) ([]model.User, error)
}

+ 9
- 0
src/implement/egg_energy_community_dividends_implement.go Прегледај датотеку

@@ -2,6 +2,7 @@

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"xorm.io/xorm"
)

@@ -12,3 +13,11 @@ func NewEggEnergyCommunityDividendsDb(engine *xorm.Engine) dao.EggEnergyCommunit
type EggEnergyCommunityDividendsDb struct {
Db *xorm.Engine
}

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

+ 9
- 0
src/implement/egg_energy_community_dividends_with_user_implement.go Прегледај датотеку

@@ -2,6 +2,7 @@

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"xorm.io/xorm"
)

@@ -12,3 +13,11 @@ func NewEggEnergyCommunityDividendsWithUserDb(engine *xorm.Engine) dao.EggEnergy
type EggEnergyCommunityDividendsWithUserDb struct {
Db *xorm.Engine
}

func (e EggEnergyCommunityDividendsWithUserDb) EggEnergyCommunityDividendsWithUserInsert(EggEnergyCommunityDividendsWithUser *model.EggEnergyCommunityDividendsWithUser) (int, error) {
_, err := e.Db.InsertOne(EggEnergyCommunityDividendsWithUser)
if err != nil {
return 0, err
}
return EggEnergyCommunityDividendsWithUser.Id, nil
}

+ 24
- 0
src/implement/public_platoon_free_punish_with_user_implement.go Прегледај датотеку

@@ -4,6 +4,7 @@ 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"
"fmt"
"xorm.io/xorm"
)

@@ -51,3 +52,26 @@ func (p PublicPlatoonFreePunishWithUserDb) PublicPlatoonFreePunishWithUserUpdate
}
return affected, nil
}

func (p PublicPlatoonFreePunishWithUserDb) PublicPlatoonFreePunishWithUserCountAndGetPageByParams(page int, limit int, params map[string]interface{}) ([]model.PublicPlatoonFreePunishWithUser, int64, error) {

var publicPlatoonFreePunishWithUser model.PublicPlatoonFreePunishWithUser
total, err := p.Db.Where("").Count(&publicPlatoonFreePunishWithUser)
if err != nil {
return nil, 0, zhios_order_relate_logx.Error(err)
}

var m []model.PublicPlatoonFreePunishWithUser
session := p.Db
var err1 error
if params != nil {
query := fmt.Sprintf("%s = ?", params["key"])
err1 = session.Where(query, params["value"]).Limit(limit, page-1).Find(&m)
} else {
err1 = session.Where("1=1").Limit(limit, page-1).Find(&m)
}
if err1 != nil {
return nil, 0, zhios_order_relate_logx.Error(err1)
}
return m, total, nil
}

+ 0
- 36
src/implement/public_platoon_user_relation_implement.go Прегледај датотеку

@@ -120,18 +120,6 @@ func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationFindByParamsByPage
}
}

func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationGetOneByUid(uid int64) (*model.PublicPlatoonUserRelation, error) {
var parent model.PublicPlatoonUserRelation
has, err := p.Db.Where("uid = ?", uid).Get(&parent)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, zhios_order_relate_logx.Error("未查询到上级用户公排记录")
}
return &parent, nil
}

func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationGetOneByPosition(position int64) (*model.PublicPlatoonUserRelation, error) {
var relation model.PublicPlatoonUserRelation
_, err := p.Db.Where("position = ?", position).Get(&relation)
@@ -140,27 +128,3 @@ func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationGetOneByPosition(p
}
return &relation, nil
}

func (p PublicPlatoonUserRelationDb) GetTreeBySmall(head *model.PublicPlatoonUserRelation, leveLimit int) ([]*model.PublicPlatoonUserRelation, error) {
if leveLimit == 0 {
leveLimit = 1
}
var res []*model.PublicPlatoonUserRelation
var queue []*model.PublicPlatoonUserRelation
queue = append(queue, head)
for len(queue) > 0 {
node := queue[0]
queue = queue[1:]
if node.Level1 > head.Level1+leveLimit {
break
}
res = append(res, node)
var son []*model.PublicPlatoonUserRelation
err1 := p.Db.Where("father_uid1 = ?", node.Uid).Find(son)
if err1 != nil {
return nil, zhios_order_relate_logx.Error(err1)
}
queue = append(queue, son...)
}
return res, nil
}

+ 19
- 0
src/implement/user_implement.go Прегледај датотеку

@@ -3,8 +3,10 @@
import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"fmt"
"reflect"
"xorm.io/xorm"
)

@@ -24,3 +26,20 @@ func (u UserDb) UserGetOneByParams(params map[string]interface{}) (*model.User,
}
return &m, nil
}

func (u UserDb) UserFindByParams(params map[string]interface{}) ([]model.User, error) {
var m []model.User
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice {
//指定In查询
if err := u.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(&m); err != nil {
return nil, zhios_order_relate_logx.Warn(err)
}
} else {
var query = fmt.Sprintf("%s =?", params["key"])
err := u.Db.Where(query, params["value"]).Find(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
}
return m, nil
}

Loading…
Откажи
Сачувај