我想从包含重复值的列表中获取不同的值,列表行中有12个键值对&我想只检查两个键的值,取决于这两个键(PONumber,POCompliant)应该得到的值。
[
{
"WR":"234860",
"Pieces":1,
"POCompliant":"YES!",
"PONumber":"SONYAR2435",
"ItemLookupCode":"SO_1_9490410_68",
"Description":"HANS 27495821",
"PriceCheck":"OK!",
"CostCheck":"Item Cost Missing!",
"BarcodeCheck":"10Digit Barcode Missing",
"NegativeQtyCheck":"OK!",
"InactiveCheck":"OK!",
"DoNotOrderCheck":"OK!"
},
{
"WR":"234860",
"Pieces":1,
"POCompliant":"YES!",
"PONumber":"SONYAR2435",
"ItemLookupCode":"SO_1_9490410_69",
"Description":"HANS 06462860",
"PriceCheck":"OK!",
"CostCheck":"Item Cost Missing!",
"BarcodeCheck":"10Digit Barcode Missing",
"NegativeQtyCheck":"OK!",
"InactiveCheck":"OK!",
"DoNotOrderCheck":"OK!"
}]
我确实喜欢按照以下方式,但它不起作用。
Gson gson = new Gson();
ScanWarehouseReceiptResponse[] listArray = gson.fromJson(response.body().getResponseBody().getScanWarehouseRecieptResponse().getScanWarehouseRecieptResult(), ScanWarehouseReceiptResponse[].class);
List<ScanWarehouseReceiptResponse> al = new ArrayList<>();
al.addAll(asList(listArray));
Set<ScanWarehouseReceiptResponse> hs = new HashSet<>();
hs.addAll(al);
al.clear();
al.addAll(hs);
答案 0 :(得分:0)
查询: 选择DISTINCT (采购单号码,POCompliant) 从 表名;