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() throws Exception {
|
List<SysSoft> list = getList();
|
if (CollectionUtils.isEmpty(list)) return;
|
|
//
|
}
|
}
|