我们有这个 java 代码来获取表中的最后一条记录:
Map<String, Condition> _keyCondn = new HashMap<String, Condition>();
_keyCondn.put(HASH_ID, new Condition()
                    .withComparisonOperator(ComparisonOperator.EQ)
                    .withAttributeValueList(new AttributeValue().withS(hashId)));
    QueryRequest qr = new QueryRequest();
    if (fltrField != null && fltrAttr != null)
    {
        _keyCondn.put(fltrField, new Condition()
                        .withComparisonOperator(ComparisonOperator.EQ)
                        .withAttributeValueList(fltrAttr));
        if (fltrIndex != null)
            qr.setIndexName(fltrIndex);
    }
    qr.withTableName(tableName)
        .withKeyConditions(_keyCondn)
        .withScanIndexForward(false);
    qr.withConsistentRead(true)
        .withLimit(1);
请求工作正常,直到我在 LSI 中包含 if 语句。有没有办法使这项工作?或者至少是一个更好的解决方案,然后“获取最后一条记录,向后扫描直到我们获得所需的值”