diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/search/controller/TextSearchController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/search/controller/TextSearchController.java index b8bd532..bfefa67 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/search/controller/TextSearchController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/search/controller/TextSearchController.java @@ -2,6 +2,7 @@ package com.ruoyi.web.controller.search.controller; import org.dromara.easyes.core.biz.EsPageInfo; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -26,6 +27,7 @@ import com.ruoyi.web.controller.search.service.ISearchService; * @author ruoyi */ @RestController +@ConditionalOnProperty(prefix = "ruoyi.search.admin-demo", name = "enabled", havingValue = "true") @RequestMapping("/search/fulltext") public class TextSearchController { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/search/service/impl/SearchImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/search/service/impl/SearchImpl.java index 1f69fd7..c78e6d1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/search/service/impl/SearchImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/search/service/impl/SearchImpl.java @@ -6,7 +6,7 @@ import jakarta.annotation.PostConstruct; import org.dromara.easyes.core.biz.EsPageInfo; import org.dromara.easyes.core.conditions.select.LambdaEsQueryWrapper; import org.dromara.easyes.core.conditions.update.LambdaEsUpdateWrapper; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.stereotype.Service; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.bean.BeanUtils; @@ -16,7 +16,6 @@ import com.ruoyi.web.controller.search.mapper.EsTextDocumentMapper; import com.ruoyi.web.controller.search.model.EsTextDocument; import com.ruoyi.web.controller.search.model.Search; import com.ruoyi.web.controller.search.service.ISearchService; -import lombok.RequiredArgsConstructor; /** * 实体模板Service业务层处理 @@ -24,13 +23,17 @@ import lombok.RequiredArgsConstructor; * @author ruoyi */ @Service -@RequiredArgsConstructor(onConstructor = @__(@Autowired)) +@ConditionalOnProperty(prefix = "ruoyi.search.admin-demo", name = "enabled", havingValue = "true") public class SearchImpl implements ISearchService { private final EsTextDocumentMapper esTextDocumentMapper; + private final SysNoticeMapper noticeMapper; - @Autowired - private SysNoticeMapper noticeMapper; + public SearchImpl(EsTextDocumentMapper esTextDocumentMapper, SysNoticeMapper noticeMapper) + { + this.esTextDocumentMapper = esTextDocumentMapper; + this.noticeMapper = noticeMapper; + } /** * 项目启动时,初始化索引及数据 diff --git a/ruoyi-portal/src/main/resources/mapper/portal/HwSearchMapper.xml b/ruoyi-portal/src/main/resources/mapper/portal/HwSearchMapper.xml index 16127b8..bf6a459 100644 --- a/ruoyi-portal/src/main/resources/mapper/portal/HwSearchMapper.xml +++ b/ruoyi-portal/src/main/resources/mapper/portal/HwSearchMapper.xml @@ -19,37 +19,18 @@ - + insert into hw_web_menu web_menu_id, diff --git a/ruoyi-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml b/ruoyi-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml index 0fc78a7..f275706 100644 --- a/ruoyi-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml +++ b/ruoyi-portal/src/main/resources/mapper/portal/HwWebMenuMapper1.xml @@ -48,7 +48,7 @@ where is_delete = '0' and web_menu_id = #{webMenuId} - + insert into hw_web_menu1 web_menu_id, @@ -107,4 +107,4 @@ #{webMenuId} - \ No newline at end of file +