Explorar el Código

git fix

tags/v0.0.2
dengbiao hace 1 semana
padre
commit
ddf64ec17e
Se han modificado 10 ficheros con 82 adiciones y 70 borrados
  1. +4
    -1
      src/dao/egg_energy_community_dividends_dao.go
  2. +4
    -1
      src/dao/egg_energy_community_dividends_with_user_dao.go
  3. +2
    -1
      src/dao/public_platoon_free_punish_with_user_dao.go
  4. +1
    -4
      src/dao/public_platoon_user_relation_dao.go
  5. +2
    -1
      src/dao/user_dao.go
  6. +10
    -1
      src/implement/egg_energy_community_dividends_implement.go
  7. +10
    -1
      src/implement/egg_energy_community_dividends_with_user_implement.go
  8. +25
    -1
      src/implement/public_platoon_free_punish_with_user_implement.go
  9. +3
    -57
      src/implement/public_platoon_user_relation_implement.go
  10. +21
    -2
      src/implement/user_implement.go

+ 4
- 1
src/dao/egg_energy_community_dividends_dao.go Ver fichero

@@ -1,5 +1,8 @@
package dao
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)
}

+ 4
- 1
src/dao/egg_energy_community_dividends_with_user_dao.go Ver fichero

@@ -1,5 +1,8 @@
package dao
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)
}

+ 2
- 1
src/dao/public_platoon_free_punish_with_user_dao.go Ver fichero

@@ -1,4 +1,4 @@
package dao
package dao

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
@@ -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)
}

+ 1
- 4
src/dao/public_platoon_user_relation_dao.go Ver fichero

@@ -1,4 +1,4 @@
package dao
package dao

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
@@ -13,8 +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)
PublicPlatoonUserRelationFind(uid int64) ([]*model.PublicPlatoonUserRelation, error)
PublicPlatoonUserRelationFindByUid(uid int64) ([]*model.PublicPlatoonUserRelation, error)
PublicPlatoonUserRelationGetOneByUid(uid int64) (*model.PublicPlatoonUserRelation, error)
PublicPlatoonUserRelationGetOneByPosition(position int64) (*model.PublicPlatoonUserRelation, error)
}

+ 2
- 1
src/dao/user_dao.go Ver fichero

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

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

type UserDao interface {
UserGetOneByParams(params map[string]interface{}) (*model.User, error)
UserFindByParams(params map[string]interface{}) ([]model.User, error)
}

+ 10
- 1
src/implement/egg_energy_community_dividends_implement.go Ver fichero

@@ -1,7 +1,8 @@
package implement
package implement

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
}

+ 10
- 1
src/implement/egg_energy_community_dividends_with_user_implement.go Ver fichero

@@ -1,7 +1,8 @@
package implement
package implement

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
}

+ 25
- 1
src/implement/public_platoon_free_punish_with_user_implement.go Ver fichero

@@ -1,9 +1,10 @@
package implement
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"
"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
}

+ 3
- 57
src/implement/public_platoon_user_relation_implement.go Ver fichero

@@ -1,4 +1,4 @@
package implement
package implement

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
@@ -120,60 +120,6 @@ func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationFindByParamsByPage
}
}

func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationFind(uid int64) ([]*model.PublicPlatoonUserRelation, error) {
var head model.PublicPlatoonUserRelation
if uid != 0 {
has, err1 := p.Db.Where("uid = ?", uid).Get(&head)
if err1 != nil {
return nil, zhios_order_relate_logx.Error(err1)
}
if has == false {
return nil, zhios_order_relate_logx.Error("未查询到数据")
}
} else {
has, err2 := p.Db.Where("level_total = ?", 1).Get(&head)
if err2 != nil {
return nil, err2
}
if has == false {
return nil, zhios_order_relate_logx.Error("未查询到数据")
}
}
relations, err3 := p.GetTreeBySmall(&head, 3)
if err3 != nil {
return nil, err3
}
return relations, nil
}

func (p PublicPlatoonUserRelationDb) PublicPlatoonUserRelationFindByUid(uid int64) ([]*model.PublicPlatoonUserRelation, error) {
var head model.PublicPlatoonUserRelation
has, err1 := p.Db.Where("uid = ?", uid).Get(&head)
if err1 != nil {
return nil, zhios_order_relate_logx.Error(err1)
}
if has == false {
return nil, zhios_order_relate_logx.Error("未查询到数据")
}
relations, err3 := p.GetTreeBySmall(&head, 0)
if err3 != nil {
return nil, err3
}
return relations, nil
}

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)
@@ -193,12 +139,12 @@ func (p PublicPlatoonUserRelationDb) GetTreeBySmall(head *model.PublicPlatoonUse
for len(queue) > 0 {
node := queue[0]
queue = queue[1:]
if node.LevelTotal > head.LevelTotal+leveLimit {
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)
err1 := p.Db.Where("father_uid1 = ?", node.Uid).Find(son)
if err1 != nil {
return nil, zhios_order_relate_logx.Error(err1)
}


+ 21
- 2
src/implement/user_implement.go Ver fichero

@@ -1,10 +1,12 @@
package implement
package implement

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

@@ -18,9 +20,26 @@ type UserDb struct {

func (u UserDb) UserGetOneByParams(params map[string]interface{}) (*model.User, error) {
var m model.User
var query = fmt.Sprintf("%s =?", params["key"])
var query = fmt.Sprintf("%s = ?", params["key"])
if has, err := u.Db.Where(query, params["value"]).Get(&m); err != nil || has == false {
return nil, zhios_order_relate_logx.Error(err)
}
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
}

Cargando…
Cancelar
Guardar