付延余
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
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
91
92
93
94
95
96
97
package com.wgcloud.service;
 
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wgcloud.entity.FileWarnInfo;
import com.wgcloud.mapper.FileWarnInfoMapper;
import com.wgcloud.mapper.FileWarnStateMapper;
import com.wgcloud.util.DateUtil;
import com.wgcloud.util.UUIDUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
 
import java.util.List;
import java.util.Map;
 
/**
 * @version v3.3
 * @ClassName:FileWarnInfoService.java
 * @author: http://www.wgstart.com
 * @date: 2021年1月16日
 * @Description: FileWarnInfoService.java
 * @Copyright: 2019-2021 wgcloud. All rights reserved.
 */
@Service
public class FileWarnInfoService {
 
    public PageInfo selectByParams(Map<String, Object> params, int currPage, int pageSize) throws Exception {
        PageHelper.startPage(currPage, pageSize);
        List<FileWarnInfo> list = fileWarnInfoMapper.selectByParams(params);
        PageInfo<FileWarnInfo> pageInfo = new PageInfo<FileWarnInfo>(list);
        return pageInfo;
    }
 
    public void save(FileWarnInfo FileWarnInfo) throws Exception {
        FileWarnInfo.setId(UUIDUtil.getUUID());
        FileWarnInfo.setCreateTime(DateUtil.getNowTime());
        if (!StringUtils.isEmpty(FileWarnInfo.getFilePath())) {
            FileWarnInfo.setFilePath(FileWarnInfo.getFilePath().trim());
        }
        fileWarnInfoMapper.save(FileWarnInfo);
    }
 
    public int deleteByHostName(Map<String, Object> map) throws Exception {
        return fileWarnInfoMapper.deleteByHostName(map);
    }
 
    @Transactional
    public void saveRecord(List<FileWarnInfo> recordList) throws Exception {
        if (recordList.size() < 1) {
            return;
        }
        for (FileWarnInfo as : recordList) {
            as.setId(UUIDUtil.getUUID());
        }
        fileWarnInfoMapper.insertList(recordList);
    }
 
    public Integer countByParams(Map<String, Object> params) throws Exception {
        return fileWarnInfoMapper.countByParams(params);
    }
 
    @Transactional
    public int deleteById(String[] id) throws Exception {
        return fileWarnInfoMapper.deleteById(id);
    }
 
    @Transactional
    public void updateRecord(List<FileWarnInfo> recordList) throws Exception {
        if (recordList.size() < 1) {
            return;
        }
        fileWarnInfoMapper.updateList(recordList);
    }
 
    public void updateById(FileWarnInfo FileWarnInfo)
            throws Exception {
        fileWarnInfoMapper.updateById(FileWarnInfo);
    }
 
    public FileWarnInfo selectById(String id) throws Exception {
        return fileWarnInfoMapper.selectById(id);
    }
 
    public List<FileWarnInfo> selectAllByParams(Map<String, Object> params) throws Exception {
        return fileWarnInfoMapper.selectAllByParams(params);
    }
 
 
    @Autowired
    private FileWarnInfoMapper fileWarnInfoMapper;
    @Autowired
    private FileWarnStateMapper fileWarnStateMapper;
 
 
}