init: 导入团队知识库内容
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
qModel Model Platform(Open Source Edition)
|
||||
*
|
||||
License:
|
||||
Released under the Apache License, Version 2.0.
|
||||
You may use, modify, and distribute this software for commercial purposes
|
||||
under the terms of the License.
|
||||
*
|
||||
Special Notice:
|
||||
All derivative versions are strictly prohibited from modifying or removing
|
||||
the default system logo and copyright information.
|
||||
For brand customization, please apply for brand customization authorization via official channels.
|
||||
*
|
||||
More information: https://qmodel.qiantong.tech/business.html
|
||||
*
|
||||
============================================================================
|
||||
*
|
||||
版权所有 © 2026 江苏千桐科技有限公司
|
||||
qModel 模型平台(开源版)
|
||||
*
|
||||
许可协议:
|
||||
本项目基于 Apache License 2.0 开源协议发布,
|
||||
允许在遵守协议的前提下进行商用、修改和分发。
|
||||
*
|
||||
特别说明:
|
||||
所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
*
|
||||
更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>qmodel-framework</artifactId>
|
||||
<groupId>tech.qiantong</groupId>
|
||||
<version>1.0.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>qmodel-es</artifactId>
|
||||
|
||||
<description>
|
||||
es模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>tech.qiantong</groupId>
|
||||
<artifactId>qmodel-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 引入easy-es最新版本的依赖-->
|
||||
<dependency>
|
||||
<groupId>org.dromara.easy-es</groupId>
|
||||
<artifactId>easy-es-boot-starter</artifactId>
|
||||
<version>2.0.0-beta7</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 排除springboot中内置的es依赖,以防和easy-es中的依赖冲突-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.elasticsearch</groupId>
|
||||
<artifactId>elasticsearch</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
* qModel Model Platform(Open Source Edition)
|
||||
* *
|
||||
* License:
|
||||
* Released under the Apache License, Version 2.0.
|
||||
* You may use, modify, and distribute this software for commercial purposes
|
||||
* under the terms of the License.
|
||||
* *
|
||||
* Special Notice:
|
||||
* All derivative versions are strictly prohibited from modifying or removing
|
||||
* the default system logo and copyright information.
|
||||
* For brand customization, please apply for brand customization authorization via official channels.
|
||||
* *
|
||||
* More information: https://qmodel.qiantong.tech/business.html
|
||||
* *
|
||||
* ============================================================================
|
||||
* *
|
||||
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||
* qModel 模型平台(开源版)
|
||||
* *
|
||||
* 许可协议:
|
||||
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||
* *
|
||||
* 特别说明:
|
||||
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
* *
|
||||
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
*/
|
||||
|
||||
package tech.qiantong.qmodel.es.esmapper.example;
|
||||
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
import tech.qiantong.qmodel.es.model.example.Document;
|
||||
|
||||
/**
|
||||
* @author qModel
|
||||
*/
|
||||
public interface DocumentMapper extends BaseEsMapper<Document> {
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
* qModel Model Platform(Open Source Edition)
|
||||
* *
|
||||
* License:
|
||||
* Released under the Apache License, Version 2.0.
|
||||
* You may use, modify, and distribute this software for commercial purposes
|
||||
* under the terms of the License.
|
||||
* *
|
||||
* Special Notice:
|
||||
* All derivative versions are strictly prohibited from modifying or removing
|
||||
* the default system logo and copyright information.
|
||||
* For brand customization, please apply for brand customization authorization via official channels.
|
||||
* *
|
||||
* More information: https://qmodel.qiantong.tech/business.html
|
||||
* *
|
||||
* ============================================================================
|
||||
* *
|
||||
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||
* qModel 模型平台(开源版)
|
||||
* *
|
||||
* 许可协议:
|
||||
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||
* *
|
||||
* 特别说明:
|
||||
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
* *
|
||||
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
*/
|
||||
|
||||
package tech.qiantong.qmodel.es.esmapper.example;
|
||||
|
||||
import org.dromara.easyes.core.kernel.BaseEsMapper;
|
||||
import tech.qiantong.qmodel.es.model.example.EsTextDocument;
|
||||
|
||||
/**
|
||||
* 全文索引检索实体
|
||||
*
|
||||
* @author qModel
|
||||
*/
|
||||
public interface EsTextDocumentMapper extends BaseEsMapper<EsTextDocument>
|
||||
{
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
* qModel Model Platform(Open Source Edition)
|
||||
* *
|
||||
* License:
|
||||
* Released under the Apache License, Version 2.0.
|
||||
* You may use, modify, and distribute this software for commercial purposes
|
||||
* under the terms of the License.
|
||||
* *
|
||||
* Special Notice:
|
||||
* All derivative versions are strictly prohibited from modifying or removing
|
||||
* the default system logo and copyright information.
|
||||
* For brand customization, please apply for brand customization authorization via official channels.
|
||||
* *
|
||||
* More information: https://qmodel.qiantong.tech/business.html
|
||||
* *
|
||||
* ============================================================================
|
||||
* *
|
||||
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||
* qModel 模型平台(开源版)
|
||||
* *
|
||||
* 许可协议:
|
||||
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||
* *
|
||||
* 特别说明:
|
||||
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
* *
|
||||
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
*/
|
||||
|
||||
package tech.qiantong.qmodel.es.model;
|
||||
|
||||
/**
|
||||
* 前端搜索对象
|
||||
*
|
||||
* @author qModel
|
||||
*/
|
||||
public class Search
|
||||
{
|
||||
/** 搜索值 */
|
||||
private String searchValue;
|
||||
|
||||
/** 当前记录起始索引 */
|
||||
private Integer pageNum;
|
||||
|
||||
/** 每页显示记录数 */
|
||||
private Integer pageSize;
|
||||
|
||||
public String getSearchValue()
|
||||
{
|
||||
return searchValue;
|
||||
}
|
||||
|
||||
public void setSearchValue(String searchValue)
|
||||
{
|
||||
this.searchValue = searchValue;
|
||||
}
|
||||
|
||||
public Integer getPageNum()
|
||||
{
|
||||
return pageNum;
|
||||
}
|
||||
|
||||
public void setPageNum(Integer pageNum)
|
||||
{
|
||||
this.pageNum = pageNum;
|
||||
}
|
||||
|
||||
public Integer getPageSize()
|
||||
{
|
||||
return pageSize;
|
||||
}
|
||||
|
||||
public void setPageSize(Integer pageSize)
|
||||
{
|
||||
this.pageSize = pageSize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Search [searchValue=" + searchValue + ", pageNum=" + pageNum + ", pageSize=" + pageSize + "]";
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
* qModel Model Platform(Open Source Edition)
|
||||
* *
|
||||
* License:
|
||||
* Released under the Apache License, Version 2.0.
|
||||
* You may use, modify, and distribute this software for commercial purposes
|
||||
* under the terms of the License.
|
||||
* *
|
||||
* Special Notice:
|
||||
* All derivative versions are strictly prohibited from modifying or removing
|
||||
* the default system logo and copyright information.
|
||||
* For brand customization, please apply for brand customization authorization via official channels.
|
||||
* *
|
||||
* More information: https://qmodel.qiantong.tech/business.html
|
||||
* *
|
||||
* ============================================================================
|
||||
* *
|
||||
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||
* qModel 模型平台(开源版)
|
||||
* *
|
||||
* 许可协议:
|
||||
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||
* *
|
||||
* 特别说明:
|
||||
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
* *
|
||||
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
*/
|
||||
|
||||
package tech.qiantong.qmodel.es.model.example;
|
||||
|
||||
import lombok.Data;
|
||||
import org.dromara.easyes.annotation.IndexId;
|
||||
import org.dromara.easyes.annotation.IndexName;
|
||||
import org.dromara.easyes.annotation.rely.IdType;
|
||||
|
||||
/**
|
||||
* @author qModel
|
||||
*/
|
||||
@Data
|
||||
@IndexName("document1_1")
|
||||
public class Document {
|
||||
/**
|
||||
* es中的唯一id
|
||||
*/
|
||||
@IndexId(type= IdType.CUSTOMIZE)
|
||||
private String id;
|
||||
/**
|
||||
* 文档标题
|
||||
*/
|
||||
private String title;
|
||||
/**
|
||||
* 文档内容
|
||||
*/
|
||||
private String content;
|
||||
}
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
* qModel Model Platform(Open Source Edition)
|
||||
* *
|
||||
* License:
|
||||
* Released under the Apache License, Version 2.0.
|
||||
* You may use, modify, and distribute this software for commercial purposes
|
||||
* under the terms of the License.
|
||||
* *
|
||||
* Special Notice:
|
||||
* All derivative versions are strictly prohibited from modifying or removing
|
||||
* the default system logo and copyright information.
|
||||
* For brand customization, please apply for brand customization authorization via official channels.
|
||||
* *
|
||||
* More information: https://qmodel.qiantong.tech/business.html
|
||||
* *
|
||||
* ============================================================================
|
||||
* *
|
||||
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||
* qModel 模型平台(开源版)
|
||||
* *
|
||||
* 许可协议:
|
||||
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||
* *
|
||||
* 特别说明:
|
||||
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
* *
|
||||
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
*/
|
||||
|
||||
package tech.qiantong.qmodel.es.model.example;
|
||||
|
||||
import org.dromara.easyes.annotation.HighLight;
|
||||
import org.dromara.easyes.annotation.IndexField;
|
||||
import org.dromara.easyes.annotation.IndexId;
|
||||
import org.dromara.easyes.annotation.IndexName;
|
||||
import org.dromara.easyes.annotation.rely.Analyzer;
|
||||
import org.dromara.easyes.annotation.rely.FieldType;
|
||||
import org.dromara.easyes.annotation.rely.IdType;
|
||||
|
||||
/**
|
||||
* 全文索引 ES数据模型
|
||||
*
|
||||
* @author qModel*/
|
||||
@IndexName("text_document")
|
||||
public class EsTextDocument
|
||||
{
|
||||
/**
|
||||
* es中的唯一id
|
||||
*/
|
||||
@IndexId(type = IdType.NONE)
|
||||
private String id;
|
||||
|
||||
/** 公告ID */
|
||||
private Long noticeId;
|
||||
|
||||
/** 公告标题 */
|
||||
@HighLight(preTag = "<font color=\"red\">", postTag = "</font>")
|
||||
@IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_MAX_WORD)
|
||||
private String noticeTitle;
|
||||
|
||||
/** 公告类型 */
|
||||
private String noticeType;
|
||||
|
||||
/** 内容 */
|
||||
@HighLight(preTag = "<font color=\"red\">", postTag = "</font>")
|
||||
@IndexField(fieldType = FieldType.TEXT, analyzer = Analyzer.IK_SMART, searchAnalyzer = Analyzer.IK_MAX_WORD)
|
||||
private String noticeContent;
|
||||
|
||||
/** 公告状态 */
|
||||
private String status;
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public Long getNoticeId()
|
||||
{
|
||||
return noticeId;
|
||||
}
|
||||
|
||||
public String getNoticeTitle()
|
||||
{
|
||||
return noticeTitle;
|
||||
}
|
||||
|
||||
public String getNoticeType()
|
||||
{
|
||||
return noticeType;
|
||||
}
|
||||
|
||||
public String getNoticeContent()
|
||||
{
|
||||
return noticeContent;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void setNoticeId(Long noticeId)
|
||||
{
|
||||
this.noticeId = noticeId;
|
||||
}
|
||||
|
||||
public void setNoticeTitle(String noticeTitle)
|
||||
{
|
||||
this.noticeTitle = noticeTitle;
|
||||
}
|
||||
|
||||
public void setNoticeType(String noticeType)
|
||||
{
|
||||
this.noticeType = noticeType;
|
||||
}
|
||||
|
||||
public void setNoticeContent(String noticeContent)
|
||||
{
|
||||
this.noticeContent = noticeContent;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
* qModel Model Platform(Open Source Edition)
|
||||
* *
|
||||
* License:
|
||||
* Released under the Apache License, Version 2.0.
|
||||
* You may use, modify, and distribute this software for commercial purposes
|
||||
* under the terms of the License.
|
||||
* *
|
||||
* Special Notice:
|
||||
* All derivative versions are strictly prohibited from modifying or removing
|
||||
* the default system logo and copyright information.
|
||||
* For brand customization, please apply for brand customization authorization via official channels.
|
||||
* *
|
||||
* More information: https://qmodel.qiantong.tech/business.html
|
||||
* *
|
||||
* ============================================================================
|
||||
* *
|
||||
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||
* qModel 模型平台(开源版)
|
||||
* *
|
||||
* 许可协议:
|
||||
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||
* *
|
||||
* 特别说明:
|
||||
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
* *
|
||||
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
*/
|
||||
|
||||
package tech.qiantong.qmodel.es.service;
|
||||
|
||||
import org.dromara.easyes.core.biz.EsPageInfo;
|
||||
import tech.qiantong.qmodel.es.model.Search;
|
||||
import tech.qiantong.qmodel.es.model.example.EsTextDocument;
|
||||
|
||||
/**
|
||||
* 检索Service
|
||||
*
|
||||
* @author qModel
|
||||
*/
|
||||
public interface ISearchService
|
||||
{
|
||||
/**
|
||||
* 查询全文检索数据
|
||||
*/
|
||||
public EsPageInfo<EsTextDocument> selectTextList(Search search);
|
||||
|
||||
/**
|
||||
* 新增全文检索数据
|
||||
*/
|
||||
public Integer addEsTextDocument(EsTextDocument esTextDocument);
|
||||
|
||||
/**
|
||||
* 修改全文检索数据
|
||||
*/
|
||||
public Integer updateEsTextDocument(EsTextDocument esTextDocument);
|
||||
|
||||
/**
|
||||
* 根据ID查询全文检索数据
|
||||
*/
|
||||
public EsTextDocument getEsTextDocument(Long noticeId);
|
||||
|
||||
/**
|
||||
* 根据ID删除全文检索数据
|
||||
*/
|
||||
public void deleteEsTextDocument(Long[] noticeIds);
|
||||
|
||||
/**
|
||||
* 重置全文检索数据
|
||||
*/
|
||||
public void resetTextCache();
|
||||
}
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
* qModel Model Platform(Open Source Edition)
|
||||
* *
|
||||
* License:
|
||||
* Released under the Apache License, Version 2.0.
|
||||
* You may use, modify, and distribute this software for commercial purposes
|
||||
* under the terms of the License.
|
||||
* *
|
||||
* Special Notice:
|
||||
* All derivative versions are strictly prohibited from modifying or removing
|
||||
* the default system logo and copyright information.
|
||||
* For brand customization, please apply for brand customization authorization via official channels.
|
||||
* *
|
||||
* More information: https://qmodel.qiantong.tech/business.html
|
||||
* *
|
||||
* ============================================================================
|
||||
* *
|
||||
* 版权所有 © 2026 江苏千桐科技有限公司
|
||||
* qModel 模型平台(开源版)
|
||||
* *
|
||||
* 许可协议:
|
||||
* 本项目基于 Apache License 2.0 开源协议发布,
|
||||
* 允许在遵守协议的前提下进行商用、修改和分发。
|
||||
* *
|
||||
* 特别说明:
|
||||
* 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
* 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
* *
|
||||
* 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
*/
|
||||
|
||||
package tech.qiantong.qmodel.es.service.impl;
|
||||
|
||||
import com.github.pagehelper.util.StringUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.stereotype.Service;
|
||||
import tech.qiantong.qmodel.es.esmapper.example.EsTextDocumentMapper;
|
||||
import tech.qiantong.qmodel.es.model.Search;
|
||||
import tech.qiantong.qmodel.es.model.example.EsTextDocument;
|
||||
import tech.qiantong.qmodel.es.service.ISearchService;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* 实体模板Service业务层处理
|
||||
*
|
||||
* @author qModel
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
|
||||
public class SearchImpl implements ISearchService {
|
||||
private final EsTextDocumentMapper esTextDocumentMapper;
|
||||
|
||||
/*
|
||||
作为实例展示,没有实际功能
|
||||
@Autowired
|
||||
private SysNoticeMapper noticeMapper;
|
||||
*/
|
||||
|
||||
/**
|
||||
* 项目启动时,初始化索引及数据
|
||||
*/
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
if (!esTextDocumentMapper.existsIndex("text_document"))
|
||||
{
|
||||
esTextDocumentMapper.createIndex();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置全文检索数据
|
||||
*/
|
||||
@Override
|
||||
public void resetTextCache() {
|
||||
esTextDocumentMapper.deleteIndex("text_document");
|
||||
esTextDocumentMapper.createIndex();
|
||||
/*
|
||||
作为实例展示,没有实际功能
|
||||
List<EsTextDocument> esTextDocumentList = new ArrayList<EsTextDocument>();
|
||||
List<SysNotice> noticeList = noticeMapper.selectNoticeList(new SysNotice());
|
||||
for (SysNotice sysNotice : noticeList)
|
||||
{
|
||||
EsTextDocument esTextDocument = new EsTextDocument();
|
||||
BeanUtils.copyBeanProp(esTextDocument, sysNotice);
|
||||
esTextDocumentList.add(esTextDocument);
|
||||
}
|
||||
esTextDocumentMapper.insertBatch(esTextDocumentList);
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全文检索数据
|
||||
*/
|
||||
@Override
|
||||
public EsPageInfo<EsTextDocument> selectTextList(Search search) {
|
||||
Integer pageNum = search.getPageNum();
|
||||
Integer pageSize = search.getPageSize();
|
||||
String searchValue = search.getSearchValue();
|
||||
|
||||
LambdaEsQueryWrapper<EsTextDocument> wrapper = new LambdaEsQueryWrapper<>();
|
||||
if (StringUtil.isNotEmpty(searchValue))
|
||||
{
|
||||
wrapper.and(a -> a.match(EsTextDocument::getNoticeTitle, searchValue, 2.0f).or()
|
||||
.match(EsTextDocument::getNoticeContent, searchValue, 1.0f));
|
||||
}
|
||||
return esTextDocumentMapper.pageQuery(wrapper, pageNum, pageSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增全文检索数据
|
||||
*/
|
||||
@Override
|
||||
public Integer addEsTextDocument(EsTextDocument esTextDocument) {
|
||||
// 如果业务需要同步到数据库
|
||||
// noticeMapper.insertNotice(new SysNotice());
|
||||
return esTextDocumentMapper.insert(esTextDocument);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改全文检索数据
|
||||
*/
|
||||
@Override
|
||||
public Integer updateEsTextDocument(EsTextDocument esTextDocument) {
|
||||
// 如果业务需要同步到数据库
|
||||
// noticeMapper.updatetNotice(new SysNotice());
|
||||
LambdaEsUpdateWrapper<EsTextDocument> wrapper = new LambdaEsUpdateWrapper<>();
|
||||
wrapper.eq(EsTextDocument::getNoticeId, esTextDocument.getNoticeId());
|
||||
return esTextDocumentMapper.update(esTextDocument, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询全文检索数据
|
||||
*/
|
||||
@Override
|
||||
public EsTextDocument getEsTextDocument(Long noticeId) {
|
||||
LambdaEsQueryWrapper<EsTextDocument> wrapper = new LambdaEsQueryWrapper<EsTextDocument>();
|
||||
wrapper.eq(EsTextDocument::getNoticeId, noticeId);
|
||||
return esTextDocumentMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID删除全文检索数据
|
||||
*/
|
||||
@Override
|
||||
public void deleteEsTextDocument(Long[] noticeIds) {
|
||||
for (Long noticeId : noticeIds)
|
||||
{
|
||||
// 如果业务需要同步到数据库
|
||||
// noticeMapper.deleteNotice(new SysNotice());
|
||||
|
||||
LambdaEsQueryWrapper<EsTextDocument> wrapper = new LambdaEsQueryWrapper<EsTextDocument>();
|
||||
wrapper.eq(EsTextDocument::getNoticeId, noticeId);
|
||||
esTextDocumentMapper.delete(wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
# Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
# qModel Model Platform(Open Source Edition)
|
||||
# *
|
||||
# License:
|
||||
# Released under the Apache License, Version 2.0.
|
||||
# You may use, modify, and distribute this software for commercial purposes
|
||||
# under the terms of the License.
|
||||
# *
|
||||
# Special Notice:
|
||||
# All derivative versions are strictly prohibited from modifying or removing
|
||||
# the default system logo and copyright information.
|
||||
# For brand customization, please apply for brand customization authorization via official channels.
|
||||
# *
|
||||
# More information: https://qmodel.qiantong.tech/business.html
|
||||
# *
|
||||
# ============================================================================
|
||||
# *
|
||||
# 版权所有 © 2026 江苏千桐科技有限公司
|
||||
# qModel 模型平台(开源版)
|
||||
# *
|
||||
# 许可协议:
|
||||
# 本项目基于 Apache License 2.0 开源协议发布,
|
||||
# 允许在遵守协议的前提下进行商用、修改和分发。
|
||||
# *
|
||||
# 特别说明:
|
||||
# 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
# 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
# *
|
||||
# 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
|
||||
# 基础配置,如果缺失可导致项目无法正常启动,其中账号密码可缺省.
|
||||
easy-es:
|
||||
# es连接地址+端口 格式必须为ip:port,如果是集群则可用逗号隔开
|
||||
address: 121.41.122.121:9200
|
||||
# 如果无账号密码则可不配置此行
|
||||
username: elastic
|
||||
password: es1234
|
||||
|
||||
# 拓展配置
|
||||
# 心跳策略时间 单位:ms
|
||||
keep-alive-millis: 3000
|
||||
# 连接超时时间 单位:ms
|
||||
connect-timeout: 5000
|
||||
# 通信超时时间 单位:ms
|
||||
socket-timeout: 60000
|
||||
# 请求超时时间 单位:ms
|
||||
request-timeout: 50000
|
||||
# 连接请求超时时间 单位:ms
|
||||
connection-request-timeout: 50000
|
||||
# 最大连接数 单位:个
|
||||
max-conn-total: 100
|
||||
# 最大连接路由数 单位:个
|
||||
max-conn-per-route: 100
|
||||
# 全局配置
|
||||
# 是否开启EE自动配置 默认开启,可缺省
|
||||
enable: true
|
||||
# 默认值为http 可缺省 也支持https免ssl方式 配置此值为 https 即可
|
||||
schema: http
|
||||
# 默认为true 打印banner 若您不期望打印banner,可配置为false
|
||||
banner: false
|
||||
global-config:
|
||||
# 是否开启小黑子模式,默认关闭, 开启后日志将更有趣,提升编码乐趣,仅供娱乐,切勿用于其它任何用途
|
||||
i-kun-mode: false
|
||||
# 索引处理模式,smoothly:平滑模式, not_smoothly:非平滑模式, manual:手动模式,,默认开启此模式
|
||||
process-index-mode: manual
|
||||
# 开启控制台打印通过本框架生成的DSL语句,默认为开启,测试稳定后的生产环境建议关闭,以提升少量性能
|
||||
print-dsl: true
|
||||
# 当前项目是否分布式项目,默认为true,在非手动托管索引模式下,若为分布式项目则会获取分布式锁,非分布式项目只需synchronized锁.
|
||||
distributed: false
|
||||
# 重建索引超时时间 单位小时,默认72H 可根据ES中存储的数据量调整
|
||||
reindexTimeOutHours: 72
|
||||
# 异步处理索引是否阻塞主线程 默认阻塞 数据量过大时调整为非阻塞异步进行 项目启动更快
|
||||
async-process-index-blocking: true
|
||||
# 分布式环境下,平滑模式,当前客户端激活最新索引最大重试次数,若数据量过大,重建索引数据迁移时间超过4320/60=72H,可调大此参数值,此参数值决定最大重试次数,超出此次数后仍未成功,则终止重试并记录异常日志
|
||||
active-release-index-max-retry: 4320
|
||||
# 分布式环境下,平滑模式,当前客户端激活最新索引重试时间间隔 若您期望最终一致性的时效性更高,可调小此值,但会牺牲一些性能
|
||||
active-release-index-fixed-delay: 60
|
||||
db-config:
|
||||
# 是否开启下划线转驼峰 默认为false
|
||||
map-underscore-to-camel-case: true
|
||||
# 索引前缀,可用于区分环境 默认为空 用法和MP的tablePrefix一样的作用和用法
|
||||
index-prefix: daily_
|
||||
# id生成策略 customize为自定义,id值由用户生成,比如取MySQL中的数据id,如缺省此项配置,则id默认策略为es自动生成
|
||||
id-type: customize
|
||||
# 字段更新策略 默认为not_null
|
||||
field-strategy: not_empty
|
||||
# 默认开启,开启后查询所有匹配数据,若不开启,会导致无法获取数据总条数,其它功能不受影响,若查询数量突破1W条时,需要同步调整@IndexName注解中的maxResultWindow也大于1w,并重建索引后方可在后续查询中生效(不推荐,建议分页查询).
|
||||
enable-track-total-hits: true
|
||||
# 数据刷新策略,默认为不刷新,若对数据时效性要求比较高,可以调整为immediate,但性能损耗高,也可以调整为折中的wait_until
|
||||
refresh-policy: immediate
|
||||
# 批量更新接口的阈值 默认值为1万,突破此值需要同步调整enable-track-total-hits=true,@IndexName.maxResultWindow > 1w,并重建索引.
|
||||
batch-update-threshold: 10000
|
||||
# 是否智能为字段添加.keyword后缀 默认开启,开启后会根据当前字段的索引类型及当前查询类型自动推断本次查询是否需要拼接.keyword后缀
|
||||
smartAddKeywordSuffix: true
|
||||
# 日志配置
|
||||
logging:
|
||||
# 开启trace级别日志,在开发时可以开启此配置,则控制台可以打印es全部请求信息及DSL语句,为了避免重复,开启此项配置后,可以将EE的print-dsl设置为false.
|
||||
level:
|
||||
tracer: false
|
||||
@@ -0,0 +1,99 @@
|
||||
# Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
# qModel Model Platform(Open Source Edition)
|
||||
# *
|
||||
# License:
|
||||
# Released under the Apache License, Version 2.0.
|
||||
# You may use, modify, and distribute this software for commercial purposes
|
||||
# under the terms of the License.
|
||||
# *
|
||||
# Special Notice:
|
||||
# All derivative versions are strictly prohibited from modifying or removing
|
||||
# the default system logo and copyright information.
|
||||
# For brand customization, please apply for brand customization authorization via official channels.
|
||||
# *
|
||||
# More information: https://qmodel.qiantong.tech/business.html
|
||||
# *
|
||||
# ============================================================================
|
||||
# *
|
||||
# 版权所有 © 2026 江苏千桐科技有限公司
|
||||
# qModel 模型平台(开源版)
|
||||
# *
|
||||
# 许可协议:
|
||||
# 本项目基于 Apache License 2.0 开源协议发布,
|
||||
# 允许在遵守协议的前提下进行商用、修改和分发。
|
||||
# *
|
||||
# 特别说明:
|
||||
# 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
# 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
# *
|
||||
# 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
|
||||
# 基础配置,如果缺失可导致项目无法正常启动,其中账号密码可缺省.
|
||||
easy-es:
|
||||
# es连接地址+端口 格式必须为ip:port,如果是集群则可用逗号隔开
|
||||
address: 121.41.122.121:9200
|
||||
# 如果无账号密码则可不配置此行
|
||||
username: elastic
|
||||
password: es1234
|
||||
|
||||
# 拓展配置
|
||||
# 心跳策略时间 单位:ms
|
||||
keep-alive-millis: 3000
|
||||
# 连接超时时间 单位:ms
|
||||
connect-timeout: 5000
|
||||
# 通信超时时间 单位:ms
|
||||
socket-timeout: 60000
|
||||
# 请求超时时间 单位:ms
|
||||
request-timeout: 50000
|
||||
# 连接请求超时时间 单位:ms
|
||||
connection-request-timeout: 50000
|
||||
# 最大连接数 单位:个
|
||||
max-conn-total: 100
|
||||
# 最大连接路由数 单位:个
|
||||
max-conn-per-route: 100
|
||||
# 全局配置
|
||||
# 是否开启EE自动配置 默认开启,可缺省
|
||||
enable: true
|
||||
# 默认值为http 可缺省 也支持https免ssl方式 配置此值为 https 即可
|
||||
schema: http
|
||||
# 默认为true 打印banner 若您不期望打印banner,可配置为false
|
||||
banner: false
|
||||
global-config:
|
||||
# 是否开启小黑子模式,默认关闭, 开启后日志将更有趣,提升编码乐趣,仅供娱乐,切勿用于其它任何用途
|
||||
i-kun-mode: false
|
||||
# 索引处理模式,smoothly:平滑模式, not_smoothly:非平滑模式, manual:手动模式,,默认开启此模式
|
||||
process-index-mode: manual
|
||||
# 开启控制台打印通过本框架生成的DSL语句,默认为开启,测试稳定后的生产环境建议关闭,以提升少量性能
|
||||
print-dsl: true
|
||||
# 当前项目是否分布式项目,默认为true,在非手动托管索引模式下,若为分布式项目则会获取分布式锁,非分布式项目只需synchronized锁.
|
||||
distributed: false
|
||||
# 重建索引超时时间 单位小时,默认72H 可根据ES中存储的数据量调整
|
||||
reindexTimeOutHours: 72
|
||||
# 异步处理索引是否阻塞主线程 默认阻塞 数据量过大时调整为非阻塞异步进行 项目启动更快
|
||||
async-process-index-blocking: true
|
||||
# 分布式环境下,平滑模式,当前客户端激活最新索引最大重试次数,若数据量过大,重建索引数据迁移时间超过4320/60=72H,可调大此参数值,此参数值决定最大重试次数,超出此次数后仍未成功,则终止重试并记录异常日志
|
||||
active-release-index-max-retry: 4320
|
||||
# 分布式环境下,平滑模式,当前客户端激活最新索引重试时间间隔 若您期望最终一致性的时效性更高,可调小此值,但会牺牲一些性能
|
||||
active-release-index-fixed-delay: 60
|
||||
db-config:
|
||||
# 是否开启下划线转驼峰 默认为false
|
||||
map-underscore-to-camel-case: true
|
||||
# 索引前缀,可用于区分环境 默认为空 用法和MP的tablePrefix一样的作用和用法
|
||||
index-prefix: daily_
|
||||
# id生成策略 customize为自定义,id值由用户生成,比如取MySQL中的数据id,如缺省此项配置,则id默认策略为es自动生成
|
||||
id-type: customize
|
||||
# 字段更新策略 默认为not_null
|
||||
field-strategy: not_empty
|
||||
# 默认开启,开启后查询所有匹配数据,若不开启,会导致无法获取数据总条数,其它功能不受影响,若查询数量突破1W条时,需要同步调整@IndexName注解中的maxResultWindow也大于1w,并重建索引后方可在后续查询中生效(不推荐,建议分页查询).
|
||||
enable-track-total-hits: true
|
||||
# 数据刷新策略,默认为不刷新,若对数据时效性要求比较高,可以调整为immediate,但性能损耗高,也可以调整为折中的wait_until
|
||||
refresh-policy: immediate
|
||||
# 批量更新接口的阈值 默认值为1万,突破此值需要同步调整enable-track-total-hits=true,@IndexName.maxResultWindow > 1w,并重建索引.
|
||||
batch-update-threshold: 10000
|
||||
# 是否智能为字段添加.keyword后缀 默认开启,开启后会根据当前字段的索引类型及当前查询类型自动推断本次查询是否需要拼接.keyword后缀
|
||||
smartAddKeywordSuffix: true
|
||||
# 日志配置
|
||||
logging:
|
||||
# 开启trace级别日志,在开发时可以开启此配置,则控制台可以打印es全部请求信息及DSL语句,为了避免重复,开启此项配置后,可以将EE的print-dsl设置为false.
|
||||
level:
|
||||
tracer: false
|
||||
@@ -0,0 +1,99 @@
|
||||
# Copyright © 2026 Qiantong Technology Co., Ltd.
|
||||
# qModel Model Platform(Open Source Edition)
|
||||
# *
|
||||
# License:
|
||||
# Released under the Apache License, Version 2.0.
|
||||
# You may use, modify, and distribute this software for commercial purposes
|
||||
# under the terms of the License.
|
||||
# *
|
||||
# Special Notice:
|
||||
# All derivative versions are strictly prohibited from modifying or removing
|
||||
# the default system logo and copyright information.
|
||||
# For brand customization, please apply for brand customization authorization via official channels.
|
||||
# *
|
||||
# More information: https://qmodel.qiantong.tech/business.html
|
||||
# *
|
||||
# ============================================================================
|
||||
# *
|
||||
# 版权所有 © 2026 江苏千桐科技有限公司
|
||||
# qModel 模型平台(开源版)
|
||||
# *
|
||||
# 许可协议:
|
||||
# 本项目基于 Apache License 2.0 开源协议发布,
|
||||
# 允许在遵守协议的前提下进行商用、修改和分发。
|
||||
# *
|
||||
# 特别说明:
|
||||
# 所有衍生版本不得修改或移除系统默认的 LOGO 和版权信息;
|
||||
# 如需定制品牌,请通过官方渠道申请品牌定制授权。
|
||||
# *
|
||||
# 更多信息请访问:https://qmodel.qiantong.tech/business.html
|
||||
|
||||
# 基础配置,如果缺失可导致项目无法正常启动,其中账号密码可缺省.
|
||||
easy-es:
|
||||
# es连接地址+端口 格式必须为ip:port,如果是集群则可用逗号隔开
|
||||
address: 121.41.122.121:9200
|
||||
# 如果无账号密码则可不配置此行
|
||||
username: elastic
|
||||
password: es1234
|
||||
|
||||
# 拓展配置
|
||||
# 心跳策略时间 单位:ms
|
||||
keep-alive-millis: 3000
|
||||
# 连接超时时间 单位:ms
|
||||
connect-timeout: 5000
|
||||
# 通信超时时间 单位:ms
|
||||
socket-timeout: 60000
|
||||
# 请求超时时间 单位:ms
|
||||
request-timeout: 50000
|
||||
# 连接请求超时时间 单位:ms
|
||||
connection-request-timeout: 50000
|
||||
# 最大连接数 单位:个
|
||||
max-conn-total: 100
|
||||
# 最大连接路由数 单位:个
|
||||
max-conn-per-route: 100
|
||||
# 全局配置
|
||||
# 是否开启EE自动配置 默认开启,可缺省
|
||||
enable: true
|
||||
# 默认值为http 可缺省 也支持https免ssl方式 配置此值为 https 即可
|
||||
schema: http
|
||||
# 默认为true 打印banner 若您不期望打印banner,可配置为false
|
||||
banner: false
|
||||
global-config:
|
||||
# 是否开启小黑子模式,默认关闭, 开启后日志将更有趣,提升编码乐趣,仅供娱乐,切勿用于其它任何用途
|
||||
i-kun-mode: false
|
||||
# 索引处理模式,smoothly:平滑模式, not_smoothly:非平滑模式, manual:手动模式,,默认开启此模式
|
||||
process-index-mode: manual
|
||||
# 开启控制台打印通过本框架生成的DSL语句,默认为开启,测试稳定后的生产环境建议关闭,以提升少量性能
|
||||
print-dsl: true
|
||||
# 当前项目是否分布式项目,默认为true,在非手动托管索引模式下,若为分布式项目则会获取分布式锁,非分布式项目只需synchronized锁.
|
||||
distributed: false
|
||||
# 重建索引超时时间 单位小时,默认72H 可根据ES中存储的数据量调整
|
||||
reindexTimeOutHours: 72
|
||||
# 异步处理索引是否阻塞主线程 默认阻塞 数据量过大时调整为非阻塞异步进行 项目启动更快
|
||||
async-process-index-blocking: true
|
||||
# 分布式环境下,平滑模式,当前客户端激活最新索引最大重试次数,若数据量过大,重建索引数据迁移时间超过4320/60=72H,可调大此参数值,此参数值决定最大重试次数,超出此次数后仍未成功,则终止重试并记录异常日志
|
||||
active-release-index-max-retry: 4320
|
||||
# 分布式环境下,平滑模式,当前客户端激活最新索引重试时间间隔 若您期望最终一致性的时效性更高,可调小此值,但会牺牲一些性能
|
||||
active-release-index-fixed-delay: 60
|
||||
db-config:
|
||||
# 是否开启下划线转驼峰 默认为false
|
||||
map-underscore-to-camel-case: true
|
||||
# 索引前缀,可用于区分环境 默认为空 用法和MP的tablePrefix一样的作用和用法
|
||||
index-prefix: daily_
|
||||
# id生成策略 customize为自定义,id值由用户生成,比如取MySQL中的数据id,如缺省此项配置,则id默认策略为es自动生成
|
||||
id-type: customize
|
||||
# 字段更新策略 默认为not_null
|
||||
field-strategy: not_empty
|
||||
# 默认开启,开启后查询所有匹配数据,若不开启,会导致无法获取数据总条数,其它功能不受影响,若查询数量突破1W条时,需要同步调整@IndexName注解中的maxResultWindow也大于1w,并重建索引后方可在后续查询中生效(不推荐,建议分页查询).
|
||||
enable-track-total-hits: true
|
||||
# 数据刷新策略,默认为不刷新,若对数据时效性要求比较高,可以调整为immediate,但性能损耗高,也可以调整为折中的wait_until
|
||||
refresh-policy: immediate
|
||||
# 批量更新接口的阈值 默认值为1万,突破此值需要同步调整enable-track-total-hits=true,@IndexName.maxResultWindow > 1w,并重建索引.
|
||||
batch-update-threshold: 10000
|
||||
# 是否智能为字段添加.keyword后缀 默认开启,开启后会根据当前字段的索引类型及当前查询类型自动推断本次查询是否需要拼接.keyword后缀
|
||||
smartAddKeywordSuffix: true
|
||||
# 日志配置
|
||||
logging:
|
||||
# 开启trace级别日志,在开发时可以开启此配置,则控制台可以打印es全部请求信息及DSL语句,为了避免重复,开启此项配置后,可以将EE的print-dsl设置为false.
|
||||
level:
|
||||
tracer: false
|
||||
Reference in New Issue
Block a user