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);
}
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;
}
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);
}
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);
}
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);
}
Aggregations