用户收件地址的代码 review

This commit is contained in:
YunaiV 2020-05-06 19:52:18 +08:00
parent 4669e81645
commit 9da9a50b92
5 changed files with 8 additions and 1 deletions

View File

@ -12,7 +12,6 @@ import lombok.experimental.Accessors;
*/
@Data
@Accessors(chain = true)
// TODO FROM 芋艿 to 小范还是放在 user 服务哈哈哈我表述错了
public class UserAddressDO extends DeletableDO {
/**

View File

@ -24,6 +24,7 @@ public interface UserAddressRPCConvert {
UserAddressRPCConvert INSTANCE = Mappers.getMapper(UserAddressRPCConvert.class);
// TODO FROM 芋艿 to 小范如果不用映射可以不用 @Mappings
@Mappings({})
UserAddressAddDTO convert(UserAddressAddRequest userAddressAddRequest);

View File

@ -15,6 +15,8 @@ import java.util.List;
*/
public interface UserAddressService {
// TODO FROM 芋艿 to 小范泛型哈另外Service 不用 CommonResult 返回
CommonResult addAddress(UserAddressAddDTO userAddressAddDTO);
CommonResult updateAddress(UserAddressUpdateDTO userAddressAddDTO);

View File

@ -22,6 +22,8 @@ public class UserAddressDO extends DeletableDO {
* 用户编号
*/
private Integer userId;
// TODO FROM 芋艿 to 小范需要增加下省市区
// TODO FROM 芋艿 to 小范想了一个增强可以靠 API 实现自动识别哈哈哈https://open.kuaidihelp.com/apitool/1019
/**
* 收件区域编号
*/
@ -41,6 +43,7 @@ public class UserAddressDO extends DeletableDO {
/**
* 是否为默认
*/
// TODO FROM 芋艿 to 小范是不是一起在捉摸个单词总觉得 hasDefault 怪怪的
private Integer hasDefault;
}

View File

@ -39,6 +39,7 @@ public class UserAddressServiceImpl implements UserAddressService {
userAddressDO.setCreateTime(new Date());
userAddressDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
// TODO FROM 芋艿 to 小范建议先更新然后在创建 UserAddressDO
// 检查是否设置为默认地址
if (UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue() == userAddressAddDTO.getHasDefault()) {
UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
@ -106,6 +107,7 @@ public class UserAddressServiceImpl implements UserAddressService {
public CommonResult removeAddress(Integer userId, Integer addressId) {
UserAddressDO userAddress = userAddressMapper.selectByUserIdAndId(userId, addressId);
// TODO FROM 芋艿 to 小范这个应该不会触发哈
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
// skip
return CommonResult.success(null);