feat: 网元数据CDR和UE事件接口新增查询删除

This commit is contained in:
TsMask
2024-03-05 16:11:47 +08:00
parent 01f7b7acec
commit e2d124a5e6
13 changed files with 217 additions and 20 deletions

View File

@@ -6,4 +6,7 @@ import "ems.agt/src/modules/network_data/model"
type ICDREvent interface {
// SelectPage 根据条件分页查询
SelectPage(querys model.CDREventQuery) map[string]any
// DeleteByIds 批量删除信息
DeleteByIds(cdrIds []string) (int64, error)
}

View File

@@ -1,6 +1,8 @@
package service
import (
"fmt"
"ems.agt/src/modules/network_data/model"
"ems.agt/src/modules/network_data/repository"
)
@@ -20,3 +22,19 @@ type CDREventImpl struct {
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")
}

View File

@@ -6,4 +6,7 @@ import "ems.agt/src/modules/network_data/model"
type IUEEvent interface {
// SelectPage 根据条件分页查询
SelectPage(querys model.UEEventQuery) map[string]any
// DeleteByIds 批量删除信息
DeleteByIds(ueIds []string) (int64, error)
}

View File

@@ -1,6 +1,8 @@
package service
import (
"fmt"
"ems.agt/src/modules/network_data/model"
"ems.agt/src/modules/network_data/repository"
)
@@ -20,3 +22,19 @@ type UEEventImpl struct {
func (r *UEEventImpl) SelectPage(querys model.UEEventQuery) map[string]any {
return r.ueEventRepository.SelectPage(querys)
}
// DeleteByIds 批量删除信息
func (r *UEEventImpl) DeleteByIds(ueIds []string) (int64, error) {
// 检查是否存在
ids := r.ueEventRepository.SelectByIds(ueIds)
if len(ids) <= 0 {
return 0, fmt.Errorf("no data")
}
if len(ids) == len(ueIds) {
rows := r.ueEventRepository.DeleteByIds(ueIds)
return rows, nil
}
// 删除信息失败!
return 0, fmt.Errorf("delete fail")
}