selectDeptList 增加二级缓存
This commit is contained in:
parent
d5e66e60b5
commit
d7e947f086
|
@ -23,6 +23,7 @@ import org.slf4j.Logger;
|
|||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.renren.common.constant.Constant;
|
||||
import io.renren.common.domain.Tsingtao_xhaProperties;
|
||||
import io.renren.common.service.impl.CrudServiceImpl;
|
||||
|
@ -33,12 +32,13 @@ import okhttp3.FormBody;
|
|||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.bytedeco.opencv.presets.opencv_core;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.CachePut;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -67,6 +67,8 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ResourceServiceImpl.class);
|
||||
|
||||
private static final String selectDeptListKey = "selectDeptList";
|
||||
|
||||
@Value("${project.place}")
|
||||
private Integer projectPlace;
|
||||
|
||||
|
@ -156,6 +158,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(key = selectDeptListKey, allEntries = true)
|
||||
public void insertWithAttrs(ResourceDTO dto) {
|
||||
ResourceEntity resourceEntity = new ResourceEntity();
|
||||
BeanUtils.copyProperties(dto, resourceEntity);
|
||||
|
@ -179,6 +182,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(key = selectDeptListKey, allEntries = true)
|
||||
public void deleteWithAttrs(JSONObject jsonObject) {
|
||||
JSONArray jsonArray = jsonObject.getJSONArray("ids");
|
||||
List<Long> idList = jsonArray.toJavaList(Long.class);
|
||||
|
@ -192,6 +196,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
|
||||
@Override
|
||||
@Transactional
|
||||
@CacheEvict(key = selectDeptListKey, allEntries = true)
|
||||
public void updateWithAttrs(ResourceDTO dto) {
|
||||
ResourceEntity resourceEntity = new ResourceEntity();
|
||||
BeanUtils.copyProperties(dto, resourceEntity);
|
||||
|
@ -527,6 +532,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
|
|||
}
|
||||
|
||||
@Override
|
||||
@CachePut(cacheNames = {selectDeptListKey}, key = "#p0")
|
||||
public Object selectDeptList(JSONObject jsonObject) {
|
||||
ArrayList<Map> resultList = new ArrayList<>();
|
||||
HashMap<String, Object> resourceMap = new HashMap<>();
|
||||
|
|
Loading…
Reference in New Issue