场景 保存信息时,发现手机号重复返回 false 编辑时,手机号与自身之外的手机号重复,返回 false, 没有重复,或者编辑时号码不变返回 true
private boolean checkMobileExists(Long shopId, CreateSupplierParam param) {
List<Supplier> supplierList = this.get(shopId, param.getContactMobile());
if (!CollectionUtils.isEmpty(supplierList)) {
if (supplierList.size() == BaseConstants.INT_ONE) {
Long existId = supplierList.get(BaseConstants.INT_ZERO).getId();
if (Objects.equals(existId, param.getId())) {
return true;
}
}
return false;
}
return true;
}