Browse Source

feat: add method to delete team assistance and team assistance deatil

master
shenjiachi 1 week ago
parent
commit
5140dbb6d8
4 changed files with 19 additions and 0 deletions
  1. +1
    -0
      src/dao/egg_energy_assistance_detail_dao.go
  2. +1
    -0
      src/dao/egg_energy_team_assistance_dao.go
  3. +9
    -0
      src/implement/egg_energy_assistance_detail_implement.go
  4. +8
    -0
      src/implement/egg_energy_team_assistance_implement.go

+ 1
- 0
src/dao/egg_energy_assistance_detail_dao.go View File

@@ -6,4 +6,5 @@ type EggEnergyAssistanceDetailDao interface {
//TODO:: You can add specific method definitions here
AssistanceDetailInsert(m *model.EggEnergyAssistanceDetail) (int64, error)
AssistanceDetailExist(uid, assistedUid, signId int64) (bool, error)
AssistanceDetailDeleteByDateByPage(date string, limit int) (int64, error)
}

+ 1
- 0
src/dao/egg_energy_team_assistance_dao.go View File

@@ -14,4 +14,5 @@ type EggEnergyTeamAssistanceDao interface {
EggEnergyTeamAssistanceGetOne(uid int64, date string) (*model.EggEnergyTeamAssistance, error)
EggEnergyTeamAssistanceInsert(EggEnergyTeamAssistance *model.EggEnergyTeamAssistance) (int64, error)
EggEnergyTeamAssistanceUpdate(id interface{}, EggEnergyTeamAssistance *model.EggEnergyTeamAssistance, forceColums ...string) (int64, error)
EggEnergyTeamAssistanceDeleteByDateByPage(date string, limit int) (int64, error)
}

+ 9
- 0
src/implement/egg_energy_assistance_detail_implement.go View File

@@ -3,6 +3,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"
"xorm.io/xorm"
)

@@ -31,3 +32,11 @@ func (e EggEnergyAssistanceDetailDb) AssistanceDetailExist(uid, assistedUid, sig
}
return exist, nil
}

func (e EggEnergyAssistanceDetailDb) AssistanceDetailDeleteByDateByPage(date string, limit int) (int64, error) {
affected, err := e.Db.Where("created_at < ?", date).Limit(limit).Delete(&model.EggEnergyAssistanceDetail{})
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
}
return affected, nil
}

+ 8
- 0
src/implement/egg_energy_team_assistance_implement.go View File

@@ -109,3 +109,11 @@ func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceUpdate(id interface{},
}
return affected, nil
}

func (e EggEnergyTeamAssistanceDb) EggEnergyTeamAssistanceDeleteByDateByPage(date string, limit int) (int64, error) {
affected, err := e.Db.Where("create_at < ?", date).Limit(limit).Delete(&model.EggEnergyTeamAssistance{})
if err != nil {
return 0, zhios_order_relate_logx.Error(err.Error())
}
return affected, nil
}

Loading…
Cancel
Save