style: 文件命名修改all_data

This commit is contained in:
TsMask
2025-02-08 17:00:58 +08:00
parent 3cbbfc44dd
commit a10c09bec8
5 changed files with 0 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"
)
// 实例化数据层 Alarm 结构体
var NewAlarm = &Alarm{
alarmRepository: repository.NewAlarm,
}
// Alarm 告警 服务层处理
type Alarm struct {
alarmRepository *repository.Alarm // 告警数据信息
}
// SelectPage 根据条件分页查询
func (r *Alarm) SelectPage(querys model.AlarmQuery) ([]model.Alarm, int64) {
return r.alarmRepository.SelectByPage(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")
}