kongdeqiang
2022-12-16 daf6a95086087ec99232eea8b4648b7541881f7c
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.wgcloud.service;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wgcloud.entity.SysLoadState;
import com.wgcloud.mapper.SysLoadStateMapper;
import com.wgcloud.util.DateUtil;
import com.wgcloud.util.UUIDUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.List;
import java.util.Map;
 
/**
 * @version v3.3
 * @ClassName:SysLoadStateService.java
 * @author: http://www.wgstart.com
 * @date: 2021年1月16日
 * @Description: SysLoadStateService.java
 * @Copyright: 2019-2021 wgcloud. All rights reserved.
 */
@Service
public class SysLoadStateService {
 
    public PageInfo selectByParams(Map<String, Object> params, int currPage, int pageSize) throws Exception {
        PageHelper.startPage(currPage, pageSize);
        List<SysLoadState> list = sysLoadStateMapper.selectByParams(params);
        PageInfo<SysLoadState> pageInfo = new PageInfo<SysLoadState>(list);
        return pageInfo;
    }
 
    public void save(SysLoadState SysLoadState) throws Exception {
        SysLoadState.setId(UUIDUtil.getUUID());
        SysLoadState.setCreateTime(DateUtil.getNowTime());
        sysLoadStateMapper.save(SysLoadState);
    }
 
    public void saveRecord(List<SysLoadState> recordList) throws Exception {
        if (recordList.size() < 1) {
            return;
        }
        for (SysLoadState as : recordList) {
            as.setId(UUIDUtil.getUUID());
        }
        sysLoadStateMapper.insertList(recordList);
    }
 
    public int deleteById(String[] id) throws Exception {
        return sysLoadStateMapper.deleteById(id);
    }
 
    public SysLoadState selectById(String id) throws Exception {
        return sysLoadStateMapper.selectById(id);
    }
 
    public List<SysLoadState> selectAllByParams(Map<String, Object> params) throws Exception {
        return sysLoadStateMapper.selectAllByParams(params);
    }
 
    /**
     * 根据IP,查询负载最高值
     * @param hostname
     * @return
     * @throws Exception
     */
    public SysLoadState selectMaxByHostname(String hostname) throws Exception {
        return sysLoadStateMapper.selectMaxByHostname(hostname);
    }
 
    /**
     * 根据起始时间,查询负载最高值
     * @param map
     * @return
     * @throws Exception
     */
    public SysLoadState selectMaxByDate(Map<String, Object> map) throws Exception{
        return sysLoadStateMapper.selectMaxByDate(map);
    }
 
    public int deleteByAccountAndDate(Map<String, Object> map) throws Exception{
        return sysLoadStateMapper.deleteByAccountAndDate(map);
    }
 
 
    @Autowired
    private SysLoadStateMapper sysLoadStateMapper;
 
 
}