|
|
@@ -0,0 +1,33 @@ |
|
|
|
package implement |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
func NewEggEnergyAssistanceDetailDb(engine *xorm.Engine) dao.EggEnergyAssistanceDetailDao { |
|
|
|
return &EggEnergyAssistanceDetailDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
type EggEnergyAssistanceDetailDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyAssistanceDetailDb) AssistanceDetailInsert(m *model.EggEnergyAssistanceDetail) (int64, error) { |
|
|
|
_, err := e.Db.InsertOne(m) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return m.Id, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggEnergyAssistanceDetailDb) AssistanceDetailExist(uid, assistedUid, signId int64) (bool, error) { |
|
|
|
exist, err := e.Db.Where("uid = ?", uid). |
|
|
|
And("assisted_uid = ?", assistedUid). |
|
|
|
And("sign_id = ?", signId).Exist(&model.EggEnergyAssistanceDetail{}) |
|
|
|
if err != nil { |
|
|
|
return false, err |
|
|
|
} |
|
|
|
return exist, nil |
|
|
|
} |