付延余
2022-12-16 f0f8ee8c4a945adbc742d9bab69382b28ad311fb
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.wgcloud.service;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wgcloud.entity.SnmpInterfaceInfo;
import com.wgcloud.mapper.SnmpInterfaceInfoMapper;
import com.wgcloud.util.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Date;
import java.util.List;
import java.util.Map;
 
@Service
public class SnmpInterfaceInfoService {
 
    @Autowired
    private SnmpInterfaceInfoMapper snmpInterfaceInfoMapper;
 
 
 
    public PageInfo selectByParams(Map<String, Object> params, int currPage, int pageSize) throws Exception {
        PageHelper.startPage(currPage, pageSize);
        List<SnmpInterfaceInfo> list = snmpInterfaceInfoMapper.selectByParams(params);
        PageInfo<SnmpInterfaceInfo> pageInfo = new PageInfo<SnmpInterfaceInfo>(list);
        return pageInfo;
    }
 
    public void save(SnmpInterfaceInfo snmpInterfaceInfo) throws Exception {
        snmpInterfaceInfo.setId(UUIDUtil.getUUID());
        snmpInterfaceInfo.setCreateTime(new Date());
        snmpInterfaceInfoMapper.save(snmpInterfaceInfo);
    }
 
    public void saveRecord(List<SnmpInterfaceInfo> recordList) throws Exception {
        if (recordList.size() < 1) {
            return;
        }
        for (SnmpInterfaceInfo as : recordList) {
            as.setId(UUIDUtil.getUUID());
        }
        snmpInterfaceInfoMapper.insertList(recordList);
    }
 
    public SnmpInterfaceInfo selectById(String id) throws Exception {
        return snmpInterfaceInfoMapper.selectById(id);
    }
 
    public List<SnmpInterfaceInfo> selectAllByParams(Map<String, Object> params) throws Exception {
        return snmpInterfaceInfoMapper.selectAllByParams(params);
    }
 
    public List<SnmpInterfaceInfo> selectByHostName(String hostname) throws Exception {
        return snmpInterfaceInfoMapper.selectByHostName(hostname);
    }
}