|
|
@@ -0,0 +1,52 @@ |
|
|
|
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" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
func NewFinWithdrawSettingDb(engine *xorm.Engine) dao.FinWithdrawSettingDao { |
|
|
|
return &FinWithdrawSettingDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
type FinWithdrawSettingDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (f FinWithdrawSettingDb) FinWithdrawSettingGetOne() (*model.FinWithdrawSetting, error) { |
|
|
|
var m model.FinWithdrawSetting |
|
|
|
get, err := f.Db.Where("id > 1").Desc("create_at").Get(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if !get { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return &m, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (f FinWithdrawSettingDb) FinWithdrawSettingInsert(m *model.FinWithdrawSetting) (int64, error) { |
|
|
|
_, err := f.Db.InsertOne(m) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return m.Id, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (f FinWithdrawSettingDb) FinWithdrawSettingUpdate(id interface{}, finWithdrawSetting *model.FinWithdrawSetting, forceColumns ...string) (int64, error) { |
|
|
|
var ( |
|
|
|
affected int64 |
|
|
|
err error |
|
|
|
) |
|
|
|
if forceColumns != nil { |
|
|
|
affected, err = f.Db.Where("id=?", id).MustCols(forceColumns...).Update(finWithdrawSetting) |
|
|
|
} else { |
|
|
|
affected, err = f.Db.Where("id=?", id).Update(finWithdrawSetting) |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |