diff --git a/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java b/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java index d4a46c4..f41fa32 100644 --- a/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java +++ b/src/main/java/com/rymcu/forest/config/WebMvcConfigurer.java @@ -71,7 +71,7 @@ public class WebMvcConfigurer extends WebMvcConfigurationSupport { public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(restAuthTokenInterceptor()).addPathPatterns("/api/**") .excludePathPatterns("/api/v1/console/**", "/api/v1/article/articles/**", "/api/v1/article/detail/**" - , "/api/v1/topic/**", "/api/v1/user/**", "/api/v1/article/*/comments", "/api/v1/rule/currency/**"); + , "/api/v1/topic/**", "/api/v1/user/**", "/api/v1/article/*/comments", "/api/v1/rule/currency/**", "/api/v1/lucene/**"); } diff --git a/src/main/java/com/rymcu/forest/mapper/SearchMapper.java b/src/main/java/com/rymcu/forest/mapper/SearchMapper.java deleted file mode 100644 index b6a8a3f..0000000 --- a/src/main/java/com/rymcu/forest/mapper/SearchMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.rymcu.forest.mapper; - -import com.rymcu.forest.dto.SearchModel; - -import java.util.List; - -/** - * @author ronger - */ -public interface SearchMapper { - /** - * 初始化文章搜索数据 - * @return - */ - List searchInitialArticleSearch(); - - /** - * 初始化作品集搜索数据 - * @return - */ - List searchInitialPortfolioSearch(); - - /** - * 初始化用户搜索数据 - * @return - */ - List searchInitialUserSearch(); -} diff --git a/src/main/java/com/rymcu/forest/service/SearchService.java b/src/main/java/com/rymcu/forest/service/SearchService.java deleted file mode 100644 index 7485bf0..0000000 --- a/src/main/java/com/rymcu/forest/service/SearchService.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.rymcu.forest.service; - -import com.rymcu.forest.dto.SearchModel; - -import java.util.List; - -/** - * @author ronger - */ -public interface SearchService { - /** - * 初始化搜索数据 - * @return - */ - List initialSearch(); -} diff --git a/src/main/java/com/rymcu/forest/service/impl/SearchServiceImpl.java b/src/main/java/com/rymcu/forest/service/impl/SearchServiceImpl.java deleted file mode 100644 index 2f583b0..0000000 --- a/src/main/java/com/rymcu/forest/service/impl/SearchServiceImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.rymcu.forest.service.impl; - -import com.rymcu.forest.core.service.redis.RedisResult; -import com.rymcu.forest.core.service.redis.RedisService; -import com.rymcu.forest.dto.SearchModel; -import com.rymcu.forest.mapper.SearchMapper; -import com.rymcu.forest.service.SearchService; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** - * @author ronger - */ -@Service -public class SearchServiceImpl implements SearchService { - - @Resource - private SearchMapper searchMapper; - @Resource - private RedisService redisService; - - @Override - public List initialSearch() { - String searchKey = "initialSearch"; - RedisResult result = redisService.getListResult(searchKey, SearchModel.class); - if (Objects.nonNull(result.getListResult())) { - return result.getListResult(); - } - List list = new ArrayList<>(); - List articleSearchModels = searchMapper.searchInitialArticleSearch(); - List portfolioSearchModels = searchMapper.searchInitialPortfolioSearch(); - List userSearchModels = searchMapper.searchInitialUserSearch(); - list.addAll(articleSearchModels); - list.addAll(portfolioSearchModels); - list.addAll(userSearchModels); - redisService.set(searchKey, list, 24 * 60 * 60); - return list; - } -} diff --git a/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java b/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java index d9e330a..411e355 100644 --- a/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java +++ b/src/main/java/com/rymcu/forest/web/api/common/CommonApiController.java @@ -34,8 +34,6 @@ public class CommonApiController { private ArticleService articleService; @Resource private PortfolioService portfolioService; - @Resource - private SearchService SearchService; @GetMapping("/get-email-code") public GlobalResult> getEmailCode(@RequestParam("email") String email) throws MessagingException { @@ -134,10 +132,4 @@ public class CommonApiController { Map map = Utils.getArticlesGlobalResult(pageInfo); return GlobalResultGenerator.genSuccessResult(map); } - - @GetMapping("/initial-search") - public GlobalResult initialSearch() { - List list = SearchService.initialSearch(); - return GlobalResultGenerator.genSuccessResult(list); - } }