io.github.icodegarden.nutrient.elasticsearch.latest.query.ElasticsearchTableDataCountStorage Maven / Gradle / Ivy
The newest version!
package io.github.icodegarden.nutrient.elasticsearch.latest.query;
import java.util.List;
import co.elastic.clients.elasticsearch.ElasticsearchClient;
import io.github.icodegarden.nutrient.elasticsearch.query.ElasticsearchQuery;
import io.github.icodegarden.nutrient.lang.query.TableDataCountPO;
import io.github.icodegarden.nutrient.lang.query.TableDataCountStorage;
import io.github.icodegarden.nutrient.lang.util.SystemUtils;
/**
*
* @author Fangfang.Xu
*
*/
public class ElasticsearchTableDataCountStorage implements TableDataCountStorage {
private static final String TABLENAME = "table_data_count";
private TableDataCountElasticsearchRepository repository;
public ElasticsearchTableDataCountStorage(ElasticsearchClient client) {
repository = new TableDataCountElasticsearchRepository(client, TABLENAME);
}
@Override
public void add(TableDataCountPO po) {
po.setId(po.getTableName());// 表名作为id,否则自动生成
repository.add(po);
}
@Override
public int updateCount(String tableName, long count) {
TableDataCountPO update = new TableDataCountPO();
update.setId(tableName);
update.setDataCount(count);
update.setUpdatedAt(SystemUtils.now());
return repository.update(update);
}
@Override
public List findAll() {
ElasticsearchQuery
© 2015 - 2025 Weber Informatics LLC | Privacy Policy