41 lines
1.0 KiB
Go
41 lines
1.0 KiB
Go
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")
|
|
}
|