|
|
@@ -0,0 +1,66 @@ |
|
|
|
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 NewEggEnergyTeamAssistanceDb(engine *xorm.Engine) dao.EggEnergyTeamAssistanceDao { |
|
|
|
return &EggEnergyTeamAssistanceDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
type EggEnergyTeamAssistanceDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceInsertBySession(session *xorm.Session, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error) { |
|
|
|
_, err := session.InsertOne(EggEnergyTeamAssistance) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return EggEnergyTeamAssistance.Id, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceUpdateBySession(session *xorm.Session, id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error) { |
|
|
|
var ( |
|
|
|
affected int64 |
|
|
|
err error |
|
|
|
) |
|
|
|
if forceColums != nil { |
|
|
|
affected, err = session.Where("id=?", id).Cols(forceColums...).Update(EggEnergyTeamAssistance) |
|
|
|
} else { |
|
|
|
affected, err = session.Where("id=?", id).Update(EggEnergyTeamAssistance) |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneByParamsBySession(session *xorm.Session, params map[string]interface{}) (*model.EggEnergyTeamAssistance, error) { |
|
|
|
var m model.EggEnergyTeamAssistance |
|
|
|
var query = fmt.Sprintf("%s =?", params["key"]) |
|
|
|
has, err := session.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 (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceGetOneBySession(session *xorm.Session, uid int64, date string) (*model.EggEnergyTeamAssistance, error) { |
|
|
|
var m model.EggEnergyTeamAssistance |
|
|
|
has, err := session.Where("uid = ?", uid).And("date = ?", date).Get(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return &m, nil |
|
|
|
} |