feat: 网元SGWC-CDR数据功能接口

This commit is contained in:
TsMask
2024-12-19 11:08:18 +08:00
parent 1621ec8511
commit 1756c2126c
5 changed files with 507 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
package service
import (
"fmt"
"be.ems/src/modules/network_data/model"
"be.ems/src/modules/network_data/repository"
)
// 实例化数据层 CDREventSGWC 结构体
var NewCDREventSGWC = &CDREventSGWC{
cdrEventRepository: repository.NewCDREventSGWC,
}
// CDREventSGWC CDR会话事件SGWC 服务层处理
type CDREventSGWC struct {
cdrEventRepository *repository.CDREventSGWC // CDR会话事件数据信息
}
// SelectPage 根据条件分页查询
func (r *CDREventSGWC) SelectPage(querys model.CDREventSGWCQuery) ([]model.CDREventSGWC, int64) {
return r.cdrEventRepository.SelectByPage(querys)
}
// DeleteByIds 批量删除信息
func (r *CDREventSGWC) 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")
}