| | |
| | | if len(serviceCollectionPlan) == 0 { |
| | | return ecode.ParamsErr |
| | | } |
| | | contractId := serviceCollectionPlan[0].ServiceContractId |
| | | sourceId := serviceCollectionPlan[0].SourceId |
| | | err := model.WithTransaction(func(db *gorm.DB) error { |
| | | err := model.NewServiceCollectionPlanSearch().SetOrm(db).SetServiceContractId(contractId).Delete() |
| | | err := model.NewServiceCollectionPlanSearch().SetOrm(db).SetSourceId(sourceId).Delete() |
| | | if err != nil { |
| | | return err |
| | | } |
| | |
| | | return ecode.OK |
| | | } |
| | | |
| | | func (ServiceCollectionPlanService) GetServiceCollectionPlanList(contractId int) ([]*model.ServiceCollectionPlan, int64, int) { |
| | | list, total, err := model.NewServiceCollectionPlanSearch().SetServiceContractId(contractId).Find() |
| | | func (ServiceCollectionPlanService) GetServiceCollectionPlanList(sourceId int) ([]*model.ServiceCollectionPlan, int64, int) { |
| | | list, total, err := model.NewServiceCollectionPlanSearch().SetSourceId(sourceId).Find() |
| | | if err != nil { |
| | | return nil, 0, ecode.DBErr |
| | | } |