Search in sources :

Example 1 with Searchable

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

the class TransactionDaoImpl 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 2 with Searchable

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

the class TransactionDaoImpl method getTxs.

@Override
public List<TransactionPo> 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<TransactionPo> localPoList = getMapper().selectByAddress(searchable);
    return localPoList;
}
Also used : TransactionPo(io.nuls.db.entity.TransactionPo) Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable)

Example 3 with Searchable

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

the class UtxoInputDaoImpl method deleteByHash.

@Override
public void deleteByHash(String txHash) {
    Searchable searchable = new Searchable();
    searchable.addCondition("tx_hash", SearchOperator.eq, txHash);
    getMapper().deleteBySearchable(searchable);
}
Also used : Searchable(io.nuls.db.dao.impl.mybatis.util.Searchable)

Example 4 with Searchable

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

the class UtxoInputDaoImpl method getTxInputs.

@Override
public List<UtxoInputPo> getTxInputs(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)

Example 5 with Searchable

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

the class UtxoOutputDaoImpl method getAllUnSpend.

@Override
public List<UtxoOutputPo> getAllUnSpend() {
    Searchable searchable = new Searchable();
    searchable.addCondition("status", SearchOperator.ne, 2);
    PageHelper.orderBy("address asc, status asc, value asc");
    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