| | |
| | | package com.ruoyi.goods.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.domain.Recipient; |
| | | import com.ruoyi.goods.mapper.RecipientMapper; |
| | | import com.ruoyi.goods.service.IRecipientService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class RecipientServiceImpl extends ServiceImpl<RecipientMapper, Recipient> implements IRecipientService { |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public String addressSaveOrUpdate(Recipient recipient) { |
| | | boolean result; |
| | | // 主键ID为空,新增收货地址 |
| | | if (StringUtils.isEmpty(String.valueOf(recipient.getId()))) { |
| | | recipient.setUserId(SecurityUtils.getUserId().intValue()); |
| | | result = this.save(recipient); |
| | | } else { |
| | | result = this.updateById(recipient); |
| | | } |
| | | return result ? "操作成功!" : "操作失败!"; |
| | | } |
| | | } |