Search in sources :

Example 21 with Searchable

use of io.nuls.db.dao.impl.mybatis.util.Searchable in project nuls by nuls-io.

the class TransactionLocalDaoImpl method getTxsCount.

@Override
public Long getTxsCount(Long blockHeight, String address, int type) {
    Searchable searchable = new Searchable();
    if (StringUtils.isBlank(address)) {
        if (type != 0) {
            searchable.addCondition("type", SearchOperator.eq, type);
        }
        if (blockHeight != null) {
            searchable.addCondition("block_height", SearchOperator.eq, blockHeight);
        }
        return getMapper().selectCount(searchable);
    }
    if (type != 0) {
        searchable.addCondition("a.type", SearchOperator.eq, type);
    }
    if (blockHeight != null) {
        searchable.addCondition("a.block_height", SearchOperator.eq, blockHeight);
    }
    searchable.addCondition("e.address", SearchOperator.eq, address);
    return getMapper().selectCountByAddress(searchable);
}
Also used : Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable)

Example 22 with Searchable

use of io.nuls.db.dao.impl.mybatis.util.Searchable in project nuls by nuls-io.

the class TransactionLocalDaoImpl method getTxs.

@Override
public List<TransactionLocalPo> getTxs(Long blockHeight, String address, int type, int start, int limit) {
    Searchable searchable = new Searchable();
    // searchable.addCondition(condition);
    if (type != 0) {
        searchable.addCondition("a.type", SearchOperator.eq, type);
    }
    if (blockHeight != null) {
        searchable.addCondition("a.block_height", SearchOperator.eq, blockHeight);
    }
    if (StringUtils.isNotBlank(address)) {
        searchable.addCondition("e.address", SearchOperator.eq, address);
    }
    if (start == 0 & limit == 0) {
        PageHelper.orderBy("a.create_time desc, b.in_index asc, c.out_index asc");
        return getMapper().selectByAddress(searchable);
    }
    PageHelper.offsetPage(start, limit);
    PageHelper.orderBy("a.create_time desc");
    List<String> txHashList = getMapper().selectTxHashListRelation(searchable);
    searchable = new Searchable();
    searchable.addCondition("a.hash", SearchOperator.in, txHashList);
    PageHelper.orderBy("a.create_time desc, b.in_index asc, c.out_index asc");
    List<TransactionLocalPo> localPoList = getMapper().selectByAddress(searchable);
    return localPoList;
}
Also used : TransactionLocalPo(io.nuls.db.entity.TransactionLocalPo) Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable)

Example 23 with Searchable

use of io.nuls.db.dao.impl.mybatis.util.Searchable in project nuls by nuls-io.

the class UtxoOutputDaoImpl method getAccountReward.

@Override
public long getAccountReward(String address, long lastTime) {
    Searchable searchable = new Searchable();
    searchable.addCondition("a.type", SearchOperator.eq, TransactionConstant.TX_TYPE_COIN_BASE);
    searchable.addCondition("b.address", SearchOperator.eq, address);
    if (lastTime > 0) {
        searchable.addCondition("a.create_time", SearchOperator.gt, lastTime);
    }
    return getMapper().getCoinBaseReward(searchable);
}
Also used : Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable)

Example 24 with Searchable

use of io.nuls.db.dao.impl.mybatis.util.Searchable in project nuls by nuls-io.

the class UtxoOutputDaoImpl method getAccountOutputs.

@Override
public List<UtxoOutputPo> getAccountOutputs(String address, byte status) {
    Searchable searchable = new Searchable();
    searchable.addCondition("status", SearchOperator.eq, status);
    searchable.addCondition("address", SearchOperator.eq, address);
    PageHelper.orderBy("value asc");
    return getMapper().selectList(searchable);
}
Also used : Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable)

Example 25 with Searchable

use of io.nuls.db.dao.impl.mybatis.util.Searchable in project nuls by nuls-io.

the class UtxoOutputDaoImpl method getTxOutputs.

@Override
public List<UtxoOutputPo> getTxOutputs(String txHash) {
    Searchable searchable = new Searchable();
    searchable.addCondition("tx_hash", SearchOperator.eq, txHash);
    return getMapper().selectList(searchable);
}
Also used : 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