master
ck 5 years ago
parent a105c8634c
commit 05326c94bf

@ -23,6 +23,7 @@ public interface ArticleMapper extends CommonMapper<Article> {
List<Category> getSecondCategory(@Param("firstCategory") Long firstCategory);
List<ArticleVo> searchArticleListByCondition(@Param("param") String param,
@Param("keyword") String keyword,
@Param("firstCategory") Long firstCategory,
@Param("secondCategory") Long secondCategory);
}

@ -147,12 +147,16 @@ public class ArticleSerivceImpl implements ArticleSerive {
Integer pageNum = jsonObject.getInteger("pageNum") == null ? 1 : jsonObject.getInteger("pageNum");
Integer pageSize = jsonObject.getInteger("pageSize") == null ? 5 : jsonObject.getInteger("pageSize");
String param = jsonObject.getString("param");
String keyword = jsonObject.getString("keyword");
if (StringUtils.isNotEmpty(param)){
param = "%" + param + "%" ;
}
if (StringUtils.isNotEmpty(keyword)){
keyword = "%" + keyword + "%" ;
}
Long firstCategory = jsonObject.getLong("firstCategory");
Long secondCategory = jsonObject.getLong("secondCategory");
List<ArticleVo> CategoryList = articleMapper.searchArticleListByCondition(param,firstCategory,secondCategory);
List<ArticleVo> CategoryList = articleMapper.searchArticleListByCondition(param,keyword,firstCategory,secondCategory);
JSONObject pageJson = PageUtils.page(CategoryList,pageNum,pageSize);
return pageJson;
}

@ -78,7 +78,10 @@
where
1 = 1
<if test="param != null and param != ''">
and (ar.title like #{param} OR ar.keyword like #{param} or c1.name like #{param} or c2.name like #{param} )
and (ar.title like #{param} or c1.name like #{param} or c2.name like #{param} )
</if>
<if test="keyword != null and keyword != ''">
and ar.keyword like #{keyword}
</if>
<if test="firstCategory != null ">
and ar.first_category = #{firstCategory}

Loading…
Cancel
Save