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