use of io.nuls.db.dao.impl.mybatis.util.Searchable in project nuls by nuls-io.
the class UtxoOutputDaoImpl method getLastDayTimeReward.
@Override
public long getLastDayTimeReward() {
Searchable searchable = new Searchable();
long lastDayTime = TimeService.currentTimeMillis() - DateUtil.DATE_TIME;
searchable.addCondition("a.type", SearchOperator.eq, TransactionConstant.TX_TYPE_COIN_BASE);
searchable.addCondition("a.create_time", SearchOperator.gt, lastDayTime);
return getMapper().getCoinBaseReward(searchable);
}
use of io.nuls.db.dao.impl.mybatis.util.Searchable in project nuls by nuls-io.
the class BaseDaoImpl method getPageList.
@Override
public List<V> getPageList(Map<String, Object> params, int pageSize, int pageNumber, String orderBy) {
Searchable searchable = null;
if (null != params && !params.isEmpty()) {
searchable = this.getSearchable(params);
}
int start = pageSize * pageNumber - pageSize;
PageHelper.offsetPage(start, pageNumber);
PageHelper.orderBy(orderBy);
return getMapper().selectList(searchable);
}
use of io.nuls.db.dao.impl.mybatis.util.Searchable in project nuls by nuls-io.
the class BlockDaoImpl method getBlockListByAddress.
@Override
public Page<BlockHeaderPo> getBlockListByAddress(String nodeAddress, int type, int pageNumber, int pageSize) {
Searchable searchable = new Searchable();
if (type == 1) {
searchable.addCondition("a.agent_address", SearchOperator.eq, nodeAddress);
} else {
searchable.addCondition("a.packing_address", SearchOperator.eq, nodeAddress);
}
PageHelper.startPage(pageNumber, pageSize);
PageHelper.orderBy("b.height desc");
List<BlockHeaderPo> blockList = getMapper().getBlockByAddress(searchable);
PageInfo<BlockHeaderPo> pageInfo = new PageInfo<>(blockList);
Page<BlockHeaderPo> page = new Page<>();
page.setTotal(pageInfo.getTotal());
page.setPageNumber(pageNumber);
page.setPageSize(pageSize);
page.setPages(pageInfo.getPages());
page.setList(blockList);
return page;
}
use of io.nuls.db.dao.impl.mybatis.util.Searchable in project nuls by nuls-io.
the class BlockDaoImpl method getBlockHeaderList.
@Override
public Page<BlockHeaderPo> getBlockHeaderList(int pageNumber, int pageSize) {
PageHelper.startPage(pageNumber, pageSize);
PageHelper.orderBy("height desc");
List<BlockHeaderPo> blockList = getMapper().selectList(new Searchable());
PageInfo<BlockHeaderPo> pageInfo = new PageInfo<>(blockList);
Page<BlockHeaderPo> page = new Page<>();
page.setTotal(pageInfo.getTotal());
page.setPageNumber(pageNumber);
page.setPageSize(pageSize);
page.setPages(pageInfo.getPages());
page.setList(blockList);
return page;
}
use of io.nuls.db.dao.impl.mybatis.util.Searchable in project nuls by nuls-io.
the class NodeDaoImpl method getNodePoList.
@Override
public List<NodePo> getNodePoList(int size, Set<String> keys) {
Searchable searchable = new Searchable();
PageHelper.startPage(1, size);
PageHelper.orderBy("last_fail_time asc");
if (!keys.isEmpty()) {
List<String> keyList = new ArrayList<>(keys);
searchable.addCondition("id", SearchOperator.notIn, keyList);
}
searchable.addCondition("status", SearchOperator.eq, 0);
List<NodePo> list = getMapper().selectList(searchable);
return list;
}
Aggregations