Search in sources :

Example 11 with Searchable

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);
}
Also used : Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable)

Example 12 with 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);
}
Also used : Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable)

Example 13 with 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;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) Page(io.nuls.core.dto.Page) Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable) BlockHeaderPo(io.nuls.db.entity.BlockHeaderPo)

Example 14 with Searchable

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;
}
Also used : PageInfo(com.github.pagehelper.PageInfo) Page(io.nuls.core.dto.Page) Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable) BlockHeaderPo(io.nuls.db.entity.BlockHeaderPo)

Example 15 with Searchable

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;
}
Also used : NodePo(io.nuls.db.entity.NodePo) Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable)

Aggregations

Searchable (io.nuls.db.dao.impl.mybatis.util.Searchable)25 Page (io.nuls.core.dto.Page)3 PageInfo (com.github.pagehelper.PageInfo)2 BlockHeaderPo (io.nuls.db.entity.BlockHeaderPo)2 TransactionPo (io.nuls.db.entity.TransactionPo)2 NodePo (io.nuls.db.entity.NodePo)1 TransactionLocalPo (io.nuls.db.entity.TransactionLocalPo)1 DbSession (io.nuls.db.transactional.annotation.DbSession)1