Merchant merchantNameInfo = merchantMapper.selectOne(new LambdaQueryWrapper<Merchant>()
.ne(Merchant::getId, id).and(c -> {
c.eq(Merchant::getMerchantName, dto.getMerchantName()).or();
c.eq(Merchant::getMerchantShortName, dto.getMerchantShortName());
})
.last("limit 1")
);
生成的sql如下
SELECT * FROM tms_merchant WHERE deleted = 0 AND (id <> ? AND (merchant_name = ? OR merchant_short_name = ?)) LIMIT 1