Commit b23e6190 authored by Junling Bu's avatar Junling Bu
Browse files

fix[litemall-db, litemall-wx-api]: 搜索关键字缺失%,同时现在查询关键数量10个

parent 73e183c1
......@@ -33,10 +33,12 @@ public class LitemallKeywordService {
return keywordsMapper.selectByExample(example);
}
public List<LitemallKeyword> queryByKeyword(String keyword) {
public List<LitemallKeyword> queryByKeyword(String keyword, Integer page, Integer size) {
LitemallKeywordExample example = new LitemallKeywordExample();
example.or().andKeywordLike(keyword);
return keywordsMapper.selectByExample(example);
example.setDistinct(true);
example.or().andKeywordLike("%" + keyword + "%");
PageHelper.startPage(page, size);
return keywordsMapper.selectByExampleSelective(example, LitemallKeyword.Column.keyword);
}
public List<LitemallKeyword> querySelective(String keyword, String url, Integer page, Integer limit, String sort, String order) {
......@@ -50,7 +52,7 @@ public class LitemallKeywordService {
criteria.andUrlLike("%" + url + "%");
}
PageHelper.startPage(page, limit);
return keywordsMapper.selectByExample(example);
return keywordsMapper.selectByExampleSelective(example);
}
public int countSelective(String keyword, String url, Integer page, Integer limit, String sort, String order) {
......
......@@ -55,7 +55,9 @@ public class WxSearchController {
return ResponseUtil.fail402();
}
List<LitemallKeyword> keywordsList = keywordsService.queryByKeyword(keyword);
Integer page = 1;
Integer size = 10;
List<LitemallKeyword> keywordsList = keywordsService.queryByKeyword(keyword, page, size);
String[] keys = new String[keywordsList.size()];
int index = 0;
for (LitemallKeyword key : keywordsList) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment