用户收件地址的代码 review
This commit is contained in:
parent
4669e81645
commit
9da9a50b92
@ -12,7 +12,6 @@ import lombok.experimental.Accessors;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
// TODO FROM 芋艿 to 小范:还是放在 user 服务,哈哈哈,我表述错了。
|
|
||||||
public class UserAddressDO extends DeletableDO {
|
public class UserAddressDO extends DeletableDO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +24,7 @@ public interface UserAddressRPCConvert {
|
|||||||
UserAddressRPCConvert INSTANCE = Mappers.getMapper(UserAddressRPCConvert.class);
|
UserAddressRPCConvert INSTANCE = Mappers.getMapper(UserAddressRPCConvert.class);
|
||||||
|
|
||||||
|
|
||||||
|
// TODO FROM 芋艿 to 小范:如果不用映射,可以不用 @Mappings 哈
|
||||||
@Mappings({})
|
@Mappings({})
|
||||||
UserAddressAddDTO convert(UserAddressAddRequest userAddressAddRequest);
|
UserAddressAddDTO convert(UserAddressAddRequest userAddressAddRequest);
|
||||||
|
|
||||||
|
@ -15,6 +15,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface UserAddressService {
|
public interface UserAddressService {
|
||||||
|
|
||||||
|
// TODO FROM 芋艿 to 小范:泛型哈。另外,Service 不用 CommonResult 返回
|
||||||
|
|
||||||
CommonResult addAddress(UserAddressAddDTO userAddressAddDTO);
|
CommonResult addAddress(UserAddressAddDTO userAddressAddDTO);
|
||||||
|
|
||||||
CommonResult updateAddress(UserAddressUpdateDTO userAddressAddDTO);
|
CommonResult updateAddress(UserAddressUpdateDTO userAddressAddDTO);
|
||||||
|
@ -22,6 +22,8 @@ public class UserAddressDO extends DeletableDO {
|
|||||||
* 用户编号
|
* 用户编号
|
||||||
*/
|
*/
|
||||||
private Integer userId;
|
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;
|
private Integer hasDefault;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ public class UserAddressServiceImpl implements UserAddressService {
|
|||||||
userAddressDO.setCreateTime(new Date());
|
userAddressDO.setCreateTime(new Date());
|
||||||
userAddressDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
|
userAddressDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
|
||||||
|
|
||||||
|
// TODO FROM 芋艿 to 小范:建议先更新,然后在创建 UserAddressDO
|
||||||
// 检查是否设置为默认地址
|
// 检查是否设置为默认地址
|
||||||
if (UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue() == userAddressAddDTO.getHasDefault()) {
|
if (UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue() == userAddressAddDTO.getHasDefault()) {
|
||||||
UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
|
UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
|
||||||
@ -106,6 +107,7 @@ public class UserAddressServiceImpl implements UserAddressService {
|
|||||||
public CommonResult removeAddress(Integer userId, Integer addressId) {
|
public CommonResult removeAddress(Integer userId, Integer addressId) {
|
||||||
UserAddressDO userAddress = userAddressMapper.selectByUserIdAndId(userId, addressId);
|
UserAddressDO userAddress = userAddressMapper.selectByUserIdAndId(userId, addressId);
|
||||||
|
|
||||||
|
// TODO FROM 芋艿 to 小范:这个应该不会触发哈
|
||||||
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
|
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
|
||||||
// skip
|
// skip
|
||||||
return CommonResult.success(null);
|
return CommonResult.success(null);
|
||||||
|
Loading…
Reference in New Issue
Block a user