Browse Source

feat: add table user_virtual_coin_flow_aggregation

master
shenjiachi 4 weeks ago
parent
commit
89a57f7fbb
3 changed files with 77 additions and 0 deletions
  1. +10
    -0
      src/dao/user_virtual_coin_flow_aggregation_dao.go
  2. +54
    -0
      src/implement/user_virtual_coin_flow_aggregation_implement.go
  3. +13
    -0
      src/model/user_virtual_coin_flow_aggregation.go

+ 10
- 0
src/dao/user_virtual_coin_flow_aggregation_dao.go View File

@@ -0,0 +1,10 @@
package dao

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

type UserVirtualCoinFlowAggregationDao interface {
//TODO:: You can add specific method definitions here
UserVirtualCoinFlowAggregationGetOneByParams(params map[string]interface{}) (*model.UserVirtualCoinFlowAggregation, error)
UserVirtualCoinFlowAggregationInsert(UserVirtualCoinFlowAggregation *model.UserVirtualCoinFlowAggregation) (int64, error)
UserVirtualCoinFlowAggregationUpdate(id interface{}, UserVirtualCoinFlowAggregation *model.UserVirtualCoinFlowAggregation, forceColums ...string) (int64, error)
}

+ 54
- 0
src/implement/user_virtual_coin_flow_aggregation_implement.go View File

@@ -0,0 +1,54 @@
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"
)

func NewUserVirtualCoinFlowAggregationDb(engine *xorm.Engine) dao.UserVirtualCoinFlowAggregationDao {
return &UserVirtualCoinFlowAggregationDb{Db: engine}
}

type UserVirtualCoinFlowAggregationDb struct {
Db *xorm.Engine
}

func (u UserVirtualCoinFlowAggregationDb) UserVirtualCoinFlowAggregationGetOneByParams(params map[string]interface{}) (*model.UserVirtualCoinFlowAggregation, error) {
var m model.UserVirtualCoinFlowAggregation
var query = fmt.Sprintf("%s =?", params["key"])
has, err := u.Db.Where(query, params["value"]).Get(&m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return &m, nil
}

func (u UserVirtualCoinFlowAggregationDb) UserVirtualCoinFlowAggregationInsert(UserVirtualCoinFlowAggregation *model.UserVirtualCoinFlowAggregation) (int64, error) {
_, err := u.Db.InsertOne(UserVirtualCoinFlowAggregation)
if err != nil {
return 0, err
}
return UserVirtualCoinFlowAggregation.Id, nil
}

func (u UserVirtualCoinFlowAggregationDb) UserVirtualCoinFlowAggregationUpdate(id interface{}, UserVirtualCoinFlowAggregation *model.UserVirtualCoinFlowAggregation, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = u.Db.Where("id=?", id).Cols(forceColums...).Update(UserVirtualCoinFlowAggregation)
} else {
affected, err = u.Db.Where("id=?", id).Update(UserVirtualCoinFlowAggregation)
}
if err != nil {
return 0, err
}
return affected, nil
}

+ 13
- 0
src/model/user_virtual_coin_flow_aggregation.go View File

@@ -0,0 +1,13 @@
package model

type UserVirtualCoinFlowAggregation struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
Uid int `json:"uid" xorm:"not null comment('用户id') index INT(11)"`
CoinId int `json:"coin_id" xorm:"not null comment('虚拟币id') INT(11)"`
TodayData string `json:"today_data" xorm:"not null comment('今日数量') DECIMAL(20,8)"`
ThisWeekData string `json:"this_week_data" xorm:"not null comment('本周数量') DECIMAL(20,8)"`
ThisMonthData string `json:"this_month_data" xorm:"not null comment('本月数量') DECIMAL(20,8)"`
NowData string `json:"now_data" xorm:"not null comment('当前数量') DECIMAL(20,8)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"`
}

Loading…
Cancel
Save