whyclxw
2025-05-08 35bd0babece513b6ee4285265f3379cbcb050e59
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.whyc.dto.Response;
import com.whyc.mapper.AlarmRelationMapper;
import com.whyc.pojo.AlarmRelation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
 
@Service
public class AlarmRelationService {
 
    @Autowired(required = false)
    private AlarmRelationMapper mapper;
 
    //查询所有的对应关系
    public Response getAll() {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.orderByAsc("id");
        List list = mapper.selectList(wrapper);
        return new Response().setII(1, list.size() > 0, list, "查询所有的对应关系");
    }
 
    //添加告警对应关系
    public Response addRelation(List<AlarmRelation> list) {
        int flag = mapper.insertBatchSomeColumn(list);
        return new Response().set(1, flag, "批量添加对应关系");
    }
}