默认地址bug修复

This commit is contained in:
LIONCITYS\lioncity
2020-10-15 11:13:40 +08:00
parent e61559ad48
commit 15b9680209

View File

@ -88,13 +88,9 @@ public class YxUserAddressServiceImpl extends BaseServiceImpl<YxUserAddressMappe
if("true".equals(param.getIs_default())){ if("true".equals(param.getIs_default())){
userAddress.setIsDefault(ShopCommonEnum.DEFAULT_1.getValue()); userAddress.setIsDefault(ShopCommonEnum.DEFAULT_1.getValue());
//新增地址如果是默认,把之前的状态改掉 //新增地址如果是默认,把之前的状态改掉
List<YxUserAddress> userAddresss = this.list(new LambdaQueryWrapper<YxUserAddress>().eq(YxUserAddress::getIsDefault,ShopCommonEnum.DEFAULT_1.getValue())); YxUserAddress address = new YxUserAddress();
if(CollectionUtil.isNotEmpty(userAddresss)){ address.setIsDefault(ShopCommonEnum.DEFAULT_0.getValue());
userAddresss.forEach(i ->{ baseMapper.update(address,new QueryWrapper<YxUserAddress>().lambda().eq(YxUserAddress::getUid,uid));
i.setIsDefault(ShopCommonEnum.DEFAULT_0.getValue());
});
this.saveOrUpdateBatch(userAddresss);
}
}else{ }else{
userAddress.setIsDefault(ShopCommonEnum.DEFAULT_0.getValue()); userAddress.setIsDefault(ShopCommonEnum.DEFAULT_0.getValue());
} }