|
|
package com.yoho.search.consumer.index.fullbuild;
|
|
|
|
|
|
import com.yoho.search.consumer.index.common.IIndexBuilder;
|
|
|
import com.yoho.search.consumer.service.base.SuggestConversionService;
|
|
|
import com.yoho.search.consumer.service.bo.ConversionBO;
|
|
|
import com.yoho.search.dal.model.SuggestConversion;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Component
|
|
|
public class SuggestConversionIndexBuilder extends IIndexBuilder {
|
|
|
|
|
|
@Autowired
|
|
|
private SuggestConversionService suggestConversionService;
|
|
|
|
|
|
@Override
|
|
|
public int getTotalCount() throws Exception {
|
|
|
return suggestConversionService.selectTotalCount();
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<?> getPageLists(int offset, int limit) throws Exception {
|
|
|
// 获取分页列表
|
|
|
List<SuggestConversion> list = suggestConversionService.selectPageList(offset, limit);
|
|
|
// 构建结果
|
|
|
List<ConversionBO> results = new ArrayList<>();
|
|
|
for (SuggestConversion item : list) {
|
|
|
results.add(new ConversionBO(item.getId(), item.getSource(), item.getDest()));
|
|
|
}
|
|
|
|
|
|
return results;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public String getId(Object object) {
|
|
|
return ((ConversionBO) object).getId().toString();
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|