|
|
@@ -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" |
|
|
|
) |
|
|
|
|
|
|
@@ -23,3 +24,28 @@ func (p PlatformGrowDataDb) PlatformGrowDataGetLastOne() (*model.PlatformGrowDat |
|
|
|
} |
|
|
|
return &m, exist, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (p PlatformGrowDataDb) PlatformGrowDataInsert(m *model.PlatformGrowData) (int64, error) { |
|
|
|
_, err := p.Db.InsertOne(m) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return m.Id, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (p PlatformGrowDataDb) PlatformGrowDataUpdate(m *model.PlatformGrowData, columns ...string) (int64, error) { |
|
|
|
affected, err := p.Db.Where("id =?", m.Id).Cols(columns...).Update(m) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (p PlatformGrowDataDb) PlatformGrowDataGetOneByParams(params map[string]interface{}) (*model.PlatformGrowData, error) { |
|
|
|
var m model.PlatformGrowData |
|
|
|
var query = fmt.Sprintf("%s = ?", params["key"]) |
|
|
|
if has, err := p.Db.Where(query, params["value"]).Get(&m); err != nil || has == false { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
return &m, nil |
|
|
|
} |