style: 去除Impl接口声明层聚焦服务函数
This commit is contained in:
@@ -1,12 +1,39 @@
|
||||
package service
|
||||
|
||||
import "be.ems/src/modules/network_data/model"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
// 告警 服务层接口
|
||||
type IAlarm interface {
|
||||
// SelectPage 根据条件分页查询
|
||||
SelectPage(querys model.AlarmQuery) map[string]any
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
DeleteByIds(ids []string) (int64, error)
|
||||
// 实例化数据层 Alarm 结构体
|
||||
var NewAlarm = &Alarm{
|
||||
alarmRepository: repository.NewAlarm,
|
||||
}
|
||||
|
||||
// Alarm 告警 服务层处理
|
||||
type Alarm struct {
|
||||
alarmRepository *repository.Alarm // 告警数据信息
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *Alarm) SelectPage(querys model.AlarmQuery) map[string]any {
|
||||
return r.alarmRepository.SelectPage(querys)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *Alarm) DeleteByIds(ids []string) (int64, error) {
|
||||
// 检查是否存在
|
||||
data := r.alarmRepository.SelectByIds(ids)
|
||||
if len(data) <= 0 {
|
||||
return 0, fmt.Errorf("no data")
|
||||
}
|
||||
|
||||
if len(data) == len(ids) {
|
||||
rows := r.alarmRepository.DeleteByIds(ids)
|
||||
return rows, nil
|
||||
}
|
||||
// 删除信息失败!
|
||||
return 0, fmt.Errorf("delete fail")
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// 实例化数据层 AlarmImpl 结构体
|
||||
var NewAlarmImpl = &AlarmImpl{
|
||||
alarmRepository: repository.NewAlarmImpl,
|
||||
}
|
||||
|
||||
// AlarmImpl 告警 服务层处理
|
||||
type AlarmImpl struct {
|
||||
// 告警数据信息
|
||||
alarmRepository repository.IAlarm
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *AlarmImpl) SelectPage(querys model.AlarmQuery) map[string]any {
|
||||
return r.alarmRepository.SelectPage(querys)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *AlarmImpl) DeleteByIds(ids []string) (int64, error) {
|
||||
// 检查是否存在
|
||||
data := r.alarmRepository.SelectByIds(ids)
|
||||
if len(data) <= 0 {
|
||||
return 0, fmt.Errorf("no data")
|
||||
}
|
||||
|
||||
if len(data) == len(ids) {
|
||||
rows := r.alarmRepository.DeleteByIds(ids)
|
||||
return rows, nil
|
||||
}
|
||||
// 删除信息失败!
|
||||
return 0, fmt.Errorf("delete fail")
|
||||
}
|
||||
@@ -1,12 +1,39 @@
|
||||
package service
|
||||
|
||||
import "be.ems/src/modules/network_data/model"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
// CDR会话事件IMS 服务层接口
|
||||
type ICDREventIMS interface {
|
||||
// SelectPage 根据条件分页查询
|
||||
SelectPage(querys model.CDREventIMSQuery) map[string]any
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
DeleteByIds(cdrIds []string) (int64, error)
|
||||
// 实例化数据层 CDREventIMS 结构体
|
||||
var NewCDREventIMS = &CDREventIMS{
|
||||
cdrEventIMSRepository: repository.NewCDREventIMS,
|
||||
}
|
||||
|
||||
// CDREventImpl CDR会话事件IMS 服务层处理
|
||||
type CDREventIMS struct {
|
||||
cdrEventIMSRepository *repository.CDREventIMS // CDR会话事件数据信息
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *CDREventIMS) SelectPage(querys model.CDREventIMSQuery) map[string]any {
|
||||
return r.cdrEventIMSRepository.SelectPage(querys)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *CDREventIMS) 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")
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
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")
|
||||
}
|
||||
@@ -1,12 +1,39 @@
|
||||
package service
|
||||
|
||||
import "be.ems/src/modules/network_data/model"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
// CDR会话事件SMF 服务层接口
|
||||
type ICDREventSMF interface {
|
||||
// SelectPage 根据条件分页查询
|
||||
SelectPage(querys model.CDREventSMFQuery) map[string]any
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
DeleteByIds(cdrIds []string) (int64, error)
|
||||
// 实例化数据层 CDREventSMF 结构体
|
||||
var NewCDREventSMF = &CDREventSMF{
|
||||
cdrEventRepository: repository.NewCDREventSMF,
|
||||
}
|
||||
|
||||
// CDREventSMF CDR会话事件SMF 服务层处理
|
||||
type CDREventSMF struct {
|
||||
cdrEventRepository *repository.CDREventSMF // CDR会话事件数据信息
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *CDREventSMF) SelectPage(querys model.CDREventSMFQuery) map[string]any {
|
||||
return r.cdrEventRepository.SelectPage(querys)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *CDREventSMF) 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")
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
var NewCDREventSMFImpl = &CDREventSMFImpl{
|
||||
cdrEventRepository: repository.NewCDREventSMFImpl,
|
||||
}
|
||||
|
||||
type CDREventSMFImpl struct {
|
||||
// CDR会话事件数据信息
|
||||
cdrEventRepository repository.ICDREventSMF
|
||||
}
|
||||
|
||||
func (r *CDREventSMFImpl) SelectPage(querys model.CDREventSMFQuery) map[string]any {
|
||||
return r.cdrEventRepository.SelectPage(querys)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *CDREventSMFImpl) 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")
|
||||
}
|
||||
@@ -1,12 +1,39 @@
|
||||
package service
|
||||
|
||||
import "be.ems/src/modules/network_data/model"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
// CDR会话事件SMSC 服务层接口
|
||||
type ICDREventSMSC interface {
|
||||
// SelectPage 根据条件分页查询
|
||||
SelectPage(querys model.CDREventSMSCQuery) map[string]any
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
DeleteByIds(cdrIds []string) (int64, error)
|
||||
// 实例化数据层 CDREventSMSC 结构体
|
||||
var NewCDREventSMSC = &CDREventSMSC{
|
||||
cdrEventRepository: repository.NewCDREventSMSC,
|
||||
}
|
||||
|
||||
// CDREventSMSC CDR会话事件SMSC 服务层处理
|
||||
type CDREventSMSC struct {
|
||||
cdrEventRepository *repository.CDREventSMSC // CDR会话事件数据信息
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *CDREventSMSC) SelectPage(querys model.CDREventSMSCQuery) map[string]any {
|
||||
return r.cdrEventRepository.SelectPage(querys)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *CDREventSMSC) 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")
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
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")
|
||||
}
|
||||
@@ -1,15 +1,79 @@
|
||||
package service
|
||||
|
||||
import "be.ems/src/modules/network_data/model"
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
// 性能统计 服务层接口
|
||||
type IPerfKPI interface {
|
||||
// SelectGoldKPI 通过网元指标数据信息
|
||||
SelectGoldKPI(query model.GoldKPIQuery) []map[string]any
|
||||
"be.ems/src/framework/constants/cachekey"
|
||||
"be.ems/src/framework/redis"
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// SelectGoldKPITitle 网元对应的指标名称
|
||||
SelectGoldKPITitle(neType string) []model.GoldKPITitle
|
||||
|
||||
// SelectUPFTotalFlow 查询UPF总流量 N3上行 N6下行
|
||||
SelectUPFTotalFlow(neType, rmUID string, day int) map[string]any
|
||||
// 实例化数据层 PerfKPI 结构体
|
||||
var NewPerfKPI = &PerfKPI{
|
||||
perfKPIRepository: repository.NewPerfKPI,
|
||||
}
|
||||
|
||||
// PerfKPI 性能统计 服务层处理
|
||||
type PerfKPI struct {
|
||||
perfKPIRepository *repository.PerfKPI // 性能统计数据信息
|
||||
}
|
||||
|
||||
// SelectGoldKPI 通过网元指标数据信息
|
||||
func (r *PerfKPI) SelectGoldKPI(query model.GoldKPIQuery) []map[string]any {
|
||||
// 获取数据指标id
|
||||
var kpiIds []string
|
||||
kpiTitles := r.perfKPIRepository.SelectGoldKPITitle(query.NeType)
|
||||
for _, kpiId := range kpiTitles {
|
||||
kpiIds = append(kpiIds, kpiId.KPIID)
|
||||
}
|
||||
|
||||
data := r.perfKPIRepository.SelectGoldKPI(query, kpiIds)
|
||||
if data == nil {
|
||||
return []map[string]any{}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// SelectGoldKPITitle 网元对应的指标名称
|
||||
func (r *PerfKPI) SelectGoldKPITitle(neType string) []model.GoldKPITitle {
|
||||
return r.perfKPIRepository.SelectGoldKPITitle(neType)
|
||||
}
|
||||
|
||||
// SelectUPFTotalFlow 查询UPF总流量 N3上行 N6下行
|
||||
func (r *PerfKPI) SelectUPFTotalFlow(neType, rmUID string, day int) map[string]any {
|
||||
now := time.Now()
|
||||
// 获取当前日期
|
||||
endDate := fmt.Sprint(now.UnixMilli())
|
||||
// 将当前日期前几天数
|
||||
startDate := fmt.Sprint(now.AddDate(0, 0, -day).Truncate(24 * time.Hour).UnixMilli())
|
||||
|
||||
var info map[string]any
|
||||
|
||||
// 读取缓存数据 小于2分钟重新缓存
|
||||
key := fmt.Sprintf("%sUPF:totalFlow:%s_%d", cachekey.NE_DATA_KEY, rmUID, day)
|
||||
infoStr, _ := redis.Get("", key)
|
||||
if infoStr != "" {
|
||||
json.Unmarshal([]byte(infoStr), &info)
|
||||
expireSecond, _ := redis.GetExpire("", key)
|
||||
if expireSecond > 120 {
|
||||
return info
|
||||
}
|
||||
}
|
||||
// down * 8 / 1000 / 1000 单位M
|
||||
info = r.perfKPIRepository.SelectUPFTotalFlow(neType, rmUID, startDate, endDate)
|
||||
if v, ok := info["up"]; ok && v == nil {
|
||||
info["up"] = 0
|
||||
}
|
||||
if v, ok := info["down"]; ok && v == nil {
|
||||
info["down"] = 0
|
||||
}
|
||||
|
||||
// 保存到缓存
|
||||
infoJSON, _ := json.Marshal(info)
|
||||
redis.SetByExpire("", key, string(infoJSON), time.Duration(10)*time.Minute)
|
||||
|
||||
return info
|
||||
}
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"be.ems/src/framework/constants/cachekey"
|
||||
"be.ems/src/framework/redis"
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// 实例化数据层 PerfKPIImpl 结构体
|
||||
var NewPerfKPIImpl = &PerfKPIImpl{
|
||||
perfKPIRepository: repository.NewPerfKPIImpl,
|
||||
}
|
||||
|
||||
// PerfKPIImpl 性能统计 服务层处理
|
||||
type PerfKPIImpl struct {
|
||||
// 性能统计数据信息
|
||||
perfKPIRepository repository.IPerfKPI
|
||||
}
|
||||
|
||||
// SelectGoldKPI 通过网元指标数据信息
|
||||
func (r *PerfKPIImpl) SelectGoldKPI(query model.GoldKPIQuery) []map[string]any {
|
||||
// 获取数据指标id
|
||||
var kpiIds []string
|
||||
kpiTitles := r.perfKPIRepository.SelectGoldKPITitle(query.NeType)
|
||||
for _, kpiId := range kpiTitles {
|
||||
kpiIds = append(kpiIds, kpiId.KPIID)
|
||||
}
|
||||
|
||||
data := r.perfKPIRepository.SelectGoldKPI(query, kpiIds)
|
||||
if data == nil {
|
||||
return []map[string]any{}
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
// SelectGoldKPITitle 网元对应的指标名称
|
||||
func (r *PerfKPIImpl) SelectGoldKPITitle(neType string) []model.GoldKPITitle {
|
||||
return r.perfKPIRepository.SelectGoldKPITitle(neType)
|
||||
}
|
||||
|
||||
// SelectUPFTotalFlow 查询UPF总流量 N3上行 N6下行
|
||||
func (r *PerfKPIImpl) SelectUPFTotalFlow(neType, rmUID string, day int) map[string]any {
|
||||
now := time.Now()
|
||||
// 获取当前日期
|
||||
endDate := fmt.Sprint(now.UnixMilli())
|
||||
// 将当前日期前几天数
|
||||
startDate := fmt.Sprint(now.AddDate(0, 0, -day).Truncate(24 * time.Hour).UnixMilli())
|
||||
|
||||
var info map[string]any
|
||||
|
||||
// 读取缓存数据 小于2分钟重新缓存
|
||||
key := fmt.Sprintf("%sUPF:totalFlow:%s_%d", cachekey.NE_DATA_KEY, rmUID, day)
|
||||
infoStr, _ := redis.Get("", key)
|
||||
if infoStr != "" {
|
||||
json.Unmarshal([]byte(infoStr), &info)
|
||||
expireSecond, _ := redis.GetExpire("", key)
|
||||
if expireSecond > 120 {
|
||||
return info
|
||||
}
|
||||
}
|
||||
// down * 8 / 1000 / 1000 单位M
|
||||
info = r.perfKPIRepository.SelectUPFTotalFlow(neType, rmUID, startDate, endDate)
|
||||
if v, ok := info["up"]; ok && v == nil {
|
||||
info["up"] = 0
|
||||
}
|
||||
if v, ok := info["down"]; ok && v == nil {
|
||||
info["down"] = 0
|
||||
}
|
||||
|
||||
// 保存到缓存
|
||||
infoJSON, _ := json.Marshal(info)
|
||||
redis.SetByExpire("", key, string(infoJSON), time.Duration(10)*time.Minute)
|
||||
|
||||
return info
|
||||
}
|
||||
@@ -1,12 +1,40 @@
|
||||
package service
|
||||
|
||||
import "be.ems/src/modules/network_data/model"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
// UE会话事件AMF 服务层接口
|
||||
type IUEEventAMF interface {
|
||||
// SelectPage 根据条件分页查询
|
||||
SelectPage(querys model.UEEventAMFQuery) map[string]any
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
DeleteByIds(ueIds []string) (int64, error)
|
||||
// 实例化数据层 UEEventAMF 结构体
|
||||
var NewUEEventAMF = &UEEventAMF{
|
||||
ueEventRepository: repository.NewUEEventAMF,
|
||||
}
|
||||
|
||||
// UEEventAMF UE会话事件AMF 服务层处理
|
||||
type UEEventAMF struct {
|
||||
// UE会话事件数据信息
|
||||
ueEventRepository *repository.UEEventAMF
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *UEEventAMF) SelectPage(querys model.UEEventAMFQuery) map[string]any {
|
||||
return r.ueEventRepository.SelectPage(querys)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *UEEventAMF) 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")
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// 实例化数据层 UEEventMMEImpl 结构体
|
||||
var NewUEEventMMEImpl = &UEEventMMEImpl{
|
||||
ueEventRepository: repository.NewUEEventMMEImpl,
|
||||
}
|
||||
|
||||
// UEEventMMEImpl UE会话事件MME 服务层处理
|
||||
type UEEventMMEImpl struct {
|
||||
// UE会话事件数据信息
|
||||
ueEventRepository repository.IUEEventMME
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *UEEventMMEImpl) SelectPage(querys model.UEEventMMEQuery) map[string]any {
|
||||
return r.ueEventRepository.SelectPage(querys)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *UEEventMMEImpl) 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")
|
||||
}
|
||||
@@ -1,12 +1,39 @@
|
||||
package service
|
||||
|
||||
import "be.ems/src/modules/network_data/model"
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
// UE会话事件MME 服务层接口
|
||||
type IUEEventMME interface {
|
||||
// SelectPage 根据条件分页查询
|
||||
SelectPage(querys model.UEEventMMEQuery) map[string]any
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
DeleteByIds(ueIds []string) (int64, error)
|
||||
// 实例化数据层 UEEventMME 结构体
|
||||
var NewUEEventMME = &UEEventMME{
|
||||
ueEventRepository: repository.NewUEEventMME,
|
||||
}
|
||||
|
||||
// UEEventMME UE会话事件MME 服务层处理
|
||||
type UEEventMME struct {
|
||||
ueEventRepository *repository.UEEventMME // UE会话事件数据信息
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *UEEventMME) SelectPage(querys model.UEEventMMEQuery) map[string]any {
|
||||
return r.ueEventRepository.SelectPage(querys)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *UEEventMME) 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")
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"be.ems/src/modules/network_data/model"
|
||||
"be.ems/src/modules/network_data/repository"
|
||||
)
|
||||
|
||||
// 实例化数据层 UEEventAMFImpl 结构体
|
||||
var NewUEEventAMFImpl = &UEEventAMFImpl{
|
||||
ueEventRepository: repository.NewUEEventAMFImpl,
|
||||
}
|
||||
|
||||
// UEEventAMFImpl UE会话事件AMF 服务层处理
|
||||
type UEEventAMFImpl struct {
|
||||
// UE会话事件数据信息
|
||||
ueEventRepository repository.IUEEventAMF
|
||||
}
|
||||
|
||||
// SelectPage 根据条件分页查询
|
||||
func (r *UEEventAMFImpl) SelectPage(querys model.UEEventAMFQuery) map[string]any {
|
||||
return r.ueEventRepository.SelectPage(querys)
|
||||
}
|
||||
|
||||
// DeleteByIds 批量删除信息
|
||||
func (r *UEEventAMFImpl) 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")
|
||||
}
|
||||
Reference in New Issue
Block a user