新增营养知识功能

This commit is contained in:
xiezhijun
2021-04-16 19:02:42 +08:00
parent 15e9561327
commit 4c8f29a50a
5 changed files with 395 additions and 18 deletions

View File

@ -37,6 +37,8 @@ public class SysNutritionQuestionServiceImpl implements ISysNutritionQuestionSer
//建立索引的字段名称
public static final String[] index_field_array = {"id", "title", "content", "key"};
//查询字段
public static final String[] index_select_field_array = {"title", "content", "key"};
/**
* 查询营养知识小问答
@ -151,7 +153,7 @@ public class SysNutritionQuestionServiceImpl implements ISysNutritionQuestionSer
try{
//建立索引
LuceneIndexUtils luceneIndexUtils = LuceneIndexUtils.getLuceneIndexUtils(index_path);
Map<String, Object> indexMap = luceneIndexUtils.queryByKeyword(sysNutritionQuestion.getKey(), index_field_array, pageNum, pageSize);
Map<String, Object> indexMap = luceneIndexUtils.queryByKeyword(sysNutritionQuestion.getKey(), index_select_field_array, pageNum, pageSize);
total = (int)indexMap.get("total");
List<Document> documentList = (List<Document>)indexMap.get("data");
if(documentList != null && documentList.size() > 0){

View File

@ -33,11 +33,6 @@
<select id="selectSysNutritionQuestionList" parameterType="SysNutritionQuestion" resultMap="SysNutritionQuestionResult">
<include refid="selectSysNutritionQuestionVo"/> where del_flag = 0
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="key != null and key != ''"> and `key` = #{key}</if>
<if test="titleContentIndex != null and titleContentIndex != ''"> and title_content_index = #{titleContentIndex}</if>
<if test="showFlag != null "> and show_flag = #{showFlag}</if>
</select>
<select id="selectSysNutritionQuestionById" parameterType="Long" resultMap="SysNutritionQuestionResult">