1
13693261870
2024-12-11 c6550a4d9bd69e59e9bb6ac6ad740e509edbd215
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package com.se.system.service.impl;
 
import java.util.List;
import com.se.common.core.utils.DateUtils;
import com.se.system.utils.CaffeineUtils;
import org.springframework.stereotype.Service;
import com.se.system.mapper.SysSoftMapper;
import com.se.system.domain.SysSoft;
import com.se.system.service.inte.ISysSoftService;
import org.springframework.util.CollectionUtils;
 
import javax.annotation.Resource;
 
/**
 * 软件Service业务层处理
 * 
 * @author se
 * @date 2024-11-22
 */
@Service
@SuppressWarnings("ALL")
public class SysSoftServiceImpl implements ISysSoftService {
    @Resource
    private SysSoftMapper sysSoftMapper;
 
    private final static String CACHE_KEY = "list:syssoft";
 
    /**
     * 查询软件
     *
     * @param softId 软件主键
     * @return 软件
     */
    @Override
    public SysSoft selectSysSoftBySoftId(Long softId) {
        return sysSoftMapper.selectSysSoftBySoftId(softId);
    }
 
    /**
     * 查询软件列表
     *
     * @param sysSoft 软件
     * @return 软件
     */
    @Override
    public List<SysSoft> selectSysSoftList(SysSoft sysSoft) {
        return sysSoftMapper.selectSysSoftList(sysSoft);
    }
 
    /**
     * 新增软件
     *
     * @param sysSoft 软件
     * @return 结果
     */
    @Override
    public int insertSysSoft(SysSoft sysSoft) {
        CaffeineUtils.remove(CACHE_KEY);
        sysSoft.setCreateTime(DateUtils.getNowDate());
        return sysSoftMapper.insertSysSoft(sysSoft);
    }
 
    /**
     * 修改软件
     *
     * @param sysSoft 软件
     * @return 结果
     */
    @Override
    public int updateSysSoft(SysSoft sysSoft) {
        CaffeineUtils.remove(CACHE_KEY);
        sysSoft.setUpdateTime(DateUtils.getNowDate());
        return sysSoftMapper.updateSysSoft(sysSoft);
    }
 
    /**
     * 批量删除软件
     *
     * @param softIds 需要删除的软件主键
     * @return 结果
     */
    @Override
    public int deleteSysSoftBySoftIds(Long[] softIds) {
        CaffeineUtils.remove(CACHE_KEY);
        return sysSoftMapper.deleteSysSoftBySoftIds(softIds);
    }
 
    /**
     * 删除软件信息
     *
     * @param softId 软件主键
     * @return 结果
     */
    @Override
    public int deleteSysSoftBySoftId(Long softId) {
        CaffeineUtils.remove(CACHE_KEY);
        return sysSoftMapper.deleteSysSoftBySoftId(softId);
    }
 
    private List<SysSoft> getList() {
        List<SysSoft> list = CaffeineUtils.getListByKey(CACHE_KEY);
        if (null == list) {
            list = selectSysSoftList(new SysSoft());
            CaffeineUtils.putListByKey(CACHE_KEY, list);
        }
 
        return list;
    }
 
    public void runSoftTest() {
        List<SysSoft> list = getList();
        if (CollectionUtils.isEmpty(list)) return;
 
        for (SysSoft soft : list) {
            //docker
        }
    }
}