|
|
@@ -53,9 +53,9 @@ func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneByParamsBySessio |
|
|
|
return &m, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneBySession(session *xorm.Session, uid int64, date string) (*model.EggEnergyTeamAssistance, error) { |
|
|
|
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOne(uid int64, date string) (*model.EggEnergyTeamAssistance, error) { |
|
|
|
var m model.EggEnergyTeamAssistance |
|
|
|
has, err := session.Where("uid = ?", uid).And("date = ?", date).Get(&m) |
|
|
|
has, err := e.Db.Where("uid = ?", uid).And("date = ?", date).Get(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
@@ -64,3 +64,27 @@ func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneBySession(sessio |
|
|
|
} |
|
|
|
return &m, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceInsert(EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error) { |
|
|
|
_, err := e.Db.InsertOne(EggEnergyTeamAssistance) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return EggEnergyTeamAssistance.Id, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceUpdate(id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error) { |
|
|
|
var ( |
|
|
|
affected int64 |
|
|
|
err error |
|
|
|
) |
|
|
|
if forceColums != nil { |
|
|
|
affected, err = e.Db.Where("id=?", id).Cols(forceColums...).Update(EggEnergyTeamAssistance) |
|
|
|
} else { |
|
|
|
affected, err = e.Db.Where("id=?", id).Update(EggEnergyTeamAssistance) |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |