Commit b5a17c2b authored by neo's avatar neo

[DEL] delete cache service interface

parent cbd872cb
package pwc.taxtech.atms.controller;
import java.util.List;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -9,21 +8,22 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import pwc.taxtech.atms.dto.CacheDto;
import pwc.taxtech.atms.service.CacheService;
import pwc.taxtech.atms.service.impl.CacheServiceImpl;
import java.util.List;
@RestController
@RequestMapping("/api/v1/cache/")
public class CacheController {
@Autowired
private CacheService cacheService;
private CacheServiceImpl cacheService;
@ApiOperation(value = "Get all cache")
@RequestMapping(value = "getallcache", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public @ResponseBody List<CacheDto> getAllCache() {
public @ResponseBody
List<CacheDto> getAllCache() {
return cacheService.getAllCache();
}
......
package pwc.taxtech.atms.service;
import java.util.List;
import pwc.taxtech.atms.dto.CacheDto;
public interface CacheService {
List<CacheDto> getAllCache();
CacheDto getCacheByKey(String cacheKey);
}
package pwc.taxtech.atms.service.impl;
import static pwc.taxtech.atms.common.CommonUtils.copyProperties;
import java.util.List;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pwc.taxtech.atms.dao.CacheMapper;
import pwc.taxtech.atms.dto.CacheDto;
import pwc.taxtech.atms.entity.Cache;
import pwc.taxtech.atms.entity.CacheExample;
import pwc.taxtech.atms.service.CacheService;
import java.util.List;
import java.util.stream.Collectors;
import static pwc.taxtech.atms.common.CommonUtils.copyProperties;
@Service
public class CacheServiceImpl implements CacheService {
public class CacheServiceImpl {
@Autowired
private CacheMapper cacheMapper;
@Override
public List<CacheDto> getAllCache() {
List<Cache> list = cacheMapper.selectByExample(null);
return list.stream().map(this::convertToCacheDto).collect(Collectors.toList());
}
@Override
public CacheDto getCacheByKey(String cacheKey) {
CacheExample example = new CacheExample();
example.createCriteria().andCacheKeyEqualTo(cacheKey);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment