feat: IMS的CDR数据导出

This commit is contained in:
TsMask
2024-06-07 19:45:21 +08:00
parent a57799c470
commit e6ae018f44
11 changed files with 400 additions and 484 deletions

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,40 @@
package service
import (
"fmt"
"be.ems/src/modules/network_data/model"
"be.ems/src/modules/network_data/repository"
)
// 实例化数据层 NewCDREventIMSImpl 结构体
var NewCDREventIMSImpl = &CDREventIMSImpl{
cdrEventIMSRepository: repository.NewCDREventIMSImpl,
}
// CDREventImpl CDR会话事件IMS 服务层处理
type CDREventIMSImpl struct {
// CDR会话事件数据信息
cdrEventIMSRepository repository.ICDREventIMS
}
// SelectPage 根据条件分页查询
func (r *CDREventIMSImpl) SelectPage(querys model.CDREventIMSQuery) map[string]any {
return r.cdrEventIMSRepository.SelectPage(querys)
}
// DeleteByIds 批量删除信息
func (r *CDREventIMSImpl) DeleteByIds(cdrIds []string) (int64, error) {
// 检查是否存在
ids := r.cdrEventIMSRepository.SelectByIds(cdrIds)
if len(ids) <= 0 {
return 0, fmt.Errorf("not data")
}
if len(ids) == len(cdrIds) {
rows := r.cdrEventIMSRepository.DeleteByIds(cdrIds)
return rows, nil
}
// 删除信息失败!
return 0, fmt.Errorf("delete fail")
}