java根据条件获取集合ID

java根据条件获取集合ID,第1张

java根据条件获取集合ID
 MerchantQueryCondition condition = new MerchantQueryCondition();
        condition.setSolutionId(getSolutionId());
        List merchantList = merchantService.getMerchantList(condition);
        List merIds = merchantList.stream().map(Merchant::getMerchantId).distinct().collect(Collectors.toList());
        if (merIds.size()>0) {
            req.setMerIds(merIds);
        }

处理为单引号作为in的查询条件

 List strArray = req.getMerIds();
 String str = String.join("','", strArray);
 String str2 = "('" + str + "')";
 String value = String.format("and dimension in %s ", str2);

sql语句

SELECt*
FROM
	payment_pri_domain_white_list
WHERe
	1 = 1
AND dimension IN ('H1001100002226','H1001100003851','H1001100003877' )

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5612724.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存