feat: SMSC-CDR数据功能接口

This commit is contained in:
TsMask
2024-08-08 20:55:42 +08:00
parent a5b77be24c
commit 657f7b3ac0
8 changed files with 488 additions and 4 deletions

View File

@@ -0,0 +1,12 @@
package service
import "be.ems/src/modules/network_data/model"
// CDR会话事件SMSC 服务层接口
type ICDREventSMSC interface {
// SelectPage 根据条件分页查询
SelectPage(querys model.CDREventSMSCQuery) map[string]any
// DeleteByIds 批量删除信息
DeleteByIds(cdrIds []string) (int64, error)
}

View File

@@ -0,0 +1,37 @@
package service
import (
"fmt"
"be.ems/src/modules/network_data/model"
"be.ems/src/modules/network_data/repository"
)
var NewCDREventSMSCImpl = &CDREventSMSCImpl{
cdrEventRepository: repository.NewCDREventSMSCImpl,
}
type CDREventSMSCImpl struct {
// CDR会话事件数据信息
cdrEventRepository repository.ICDREventSMSC
}
func (r *CDREventSMSCImpl) SelectPage(querys model.CDREventSMSCQuery) map[string]any {
return r.cdrEventRepository.SelectPage(querys)
}
// DeleteByIds 批量删除信息
func (r *CDREventSMSCImpl) DeleteByIds(cdrIds []string) (int64, error) {
// 检查是否存在
ids := r.cdrEventRepository.SelectByIds(cdrIds)
if len(ids) <= 0 {
return 0, fmt.Errorf("not data")
}
if len(ids) == len(cdrIds) {
rows := r.cdrEventRepository.DeleteByIds(cdrIds)
return rows, nil
}
// 删除信息失败!
return 0, fmt.Errorf("delete fail")
}