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