diff --git a/user/pom.xml b/user/pom.xml
index 81aae4ffc..6418775b8 100644
--- a/user/pom.xml
+++ b/user/pom.xml
@@ -19,6 +19,8 @@
user-rest
user-rpc
user-rpc-api
+ user-biz-api
+ user-biz
diff --git a/user/user-biz-api/pom.xml b/user/user-biz-api/pom.xml
new file mode 100644
index 000000000..85d7f33aa
--- /dev/null
+++ b/user/user-biz-api/pom.xml
@@ -0,0 +1,15 @@
+
+
+
+ user
+ cn.iocoder.mall
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ user-biz-api
+
+
+
\ No newline at end of file
diff --git a/user/user-biz/pom.xml b/user/user-biz/pom.xml
new file mode 100644
index 000000000..50b38c0ab
--- /dev/null
+++ b/user/user-biz/pom.xml
@@ -0,0 +1,89 @@
+
+
+
+ user
+ cn.iocoder.mall
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ user-biz
+
+
+
+
+
+ cn.iocoder.mall
+ system-biz-api
+ 1.0-SNAPSHOT
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter
+
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+ org.springframework
+ spring-tx
+
+
+ org.springframework
+ spring-jdbc
+
+
+ com.alibaba
+ druid-spring-boot-starter
+
+
+
+ cn.iocoder.mall
+ mall-spring-boot-starter-mybatis
+ 1.0-SNAPSHOT
+
+
+
+
+ com.yunpian.sdk
+ yunpian-java-sdk
+
+
+ com.aliyun
+ aliyun-java-sdk-core
+
+
+
+
+ com.qiniu
+ qiniu-java-sdk
+
+
+
+
+ org.mapstruct
+ mapstruct
+
+
+ org.mapstruct
+ mapstruct-jdk8
+
+
+ org.projectlombok
+ lombok
+
+
+
+ com.alibaba
+ fastjson
+
+
+
\ No newline at end of file
diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/bo/package-info.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/bo/package-info.java
new file mode 100644
index 000000000..d4260b548
--- /dev/null
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/bo/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:31 下午
+ */
+package cn.iocoder.mall.user.biz.bo;
\ No newline at end of file
diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/bo/user/UserAddressBO.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/bo/user/UserAddressBO.java
similarity index 94%
rename from system/system-biz/src/main/java/cn/iocoder/mall/system/biz/bo/user/UserAddressBO.java
rename to user/user-biz/src/main/java/cn/iocoder/mall/user/biz/bo/user/UserAddressBO.java
index 7b1aec9d1..e598e5a9b 100644
--- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/bo/user/UserAddressBO.java
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/bo/user/UserAddressBO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.system.biz.bo.user;
+package cn.iocoder.mall.user.biz.bo.user;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/convert/package-info.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/convert/package-info.java
new file mode 100644
index 000000000..05c3a5f0d
--- /dev/null
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/convert/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:31 下午
+ */
+package cn.iocoder.mall.user.biz.convert;
\ No newline at end of file
diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/convert/user/UserAddressConvert.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/convert/user/UserAddressConvert.java
similarity index 69%
rename from system/system-biz/src/main/java/cn/iocoder/mall/system/biz/convert/user/UserAddressConvert.java
rename to user/user-biz/src/main/java/cn/iocoder/mall/user/biz/convert/user/UserAddressConvert.java
index c090efd8b..21231e225 100644
--- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/convert/user/UserAddressConvert.java
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/convert/user/UserAddressConvert.java
@@ -1,9 +1,9 @@
-package cn.iocoder.mall.system.biz.convert.user;
+package cn.iocoder.mall.user.biz.convert.user;
-import cn.iocoder.mall.system.biz.bo.user.UserAddressBO;
-import cn.iocoder.mall.system.biz.dataobject.user.UserAddressDO;
-import cn.iocoder.mall.system.biz.dto.user.UserAddressAddDTO;
-import cn.iocoder.mall.system.biz.dto.user.UserAddressUpdateDTO;
+import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
+import cn.iocoder.mall.user.biz.dataobject.user.UserAddressDO;
+import cn.iocoder.mall.user.biz.dto.user.UserAddressAddDTO;
+import cn.iocoder.mall.user.biz.dto.user.UserAddressUpdateDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dao/package-info.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dao/package-info.java
new file mode 100644
index 000000000..f48f317d3
--- /dev/null
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dao/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:28 下午
+ */
+package cn.iocoder.mall.user.biz.dao;
\ No newline at end of file
diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dao/user/UserAddressMapper.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dao/user/UserAddressMapper.java
new file mode 100644
index 000000000..9534b6df8
--- /dev/null
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dao/user/UserAddressMapper.java
@@ -0,0 +1,33 @@
+package cn.iocoder.mall.user.biz.dao.user;
+
+import cn.iocoder.mall.user.biz.dataobject.user.UserAddressDO;
+import cn.iocoder.mall.user.biz.enums.user.UserAddressHasDefaultEnum;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+
+/**
+ * 用户 地址
+ *
+ * @author Sin
+ * @time 2019-04-06 13:29
+ */
+@Repository
+// TODO FROM 芋艿 to 小范:替换成 Mybatis Plus
+public interface UserAddressMapper extends BaseMapper {
+
+ default List selectByUserId(Integer userId) {
+ LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(UserAddressDO::getUserId, userId);
+ return selectList(wrapper);
+ }
+
+ default UserAddressDO selectHasDefault(Integer userId) {
+ LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>();
+ wrapper.eq(UserAddressDO::getUserId, userId);
+ wrapper.eq(UserAddressDO::getHasDefault, UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue());
+ return selectOne(wrapper);
+ }
+}
diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dataobject/package-info.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dataobject/package-info.java
new file mode 100644
index 000000000..8d97d97b4
--- /dev/null
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dataobject/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:27 下午
+ */
+package cn.iocoder.mall.user.biz.dataobject;
\ No newline at end of file
diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/user/UserAddressDO.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dataobject/user/UserAddressDO.java
similarity index 94%
rename from system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/user/UserAddressDO.java
rename to user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dataobject/user/UserAddressDO.java
index d3eaae46c..13422ac7c 100644
--- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dataobject/user/UserAddressDO.java
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dataobject/user/UserAddressDO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.system.biz.dataobject.user;
+package cn.iocoder.mall.user.biz.dataobject.user;
import cn.iocoder.mall.mybatis.dataobject.DeletableDO;
import lombok.Data;
diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dto/package-info.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dto/package-info.java
new file mode 100644
index 000000000..0a7a48c4f
--- /dev/null
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dto/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:29 下午
+ */
+package cn.iocoder.mall.user.biz.dto;
\ No newline at end of file
diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/user/UserAddressAddDTO.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dto/user/UserAddressAddDTO.java
similarity index 93%
rename from system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/user/UserAddressAddDTO.java
rename to user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dto/user/UserAddressAddDTO.java
index b34b7853f..acb828acb 100644
--- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/user/UserAddressAddDTO.java
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dto/user/UserAddressAddDTO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.system.biz.dto.user;
+package cn.iocoder.mall.user.biz.dto.user;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/user/UserAddressUpdateDTO.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dto/user/UserAddressUpdateDTO.java
similarity index 94%
rename from system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/user/UserAddressUpdateDTO.java
rename to user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dto/user/UserAddressUpdateDTO.java
index 34bb51818..f793d3de6 100644
--- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/dto/user/UserAddressUpdateDTO.java
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/dto/user/UserAddressUpdateDTO.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.system.biz.dto.user;
+package cn.iocoder.mall.user.biz.dto.user;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/enums/package-info.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/enums/package-info.java
new file mode 100644
index 000000000..b096c9f2e
--- /dev/null
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/enums/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:29 下午
+ */
+package cn.iocoder.mall.user.biz.enums;
\ No newline at end of file
diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/enums/userAddress/UserAddressHasDefaultEnum.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/enums/user/UserAddressHasDefaultEnum.java
similarity index 82%
rename from system/system-biz/src/main/java/cn/iocoder/mall/system/biz/enums/userAddress/UserAddressHasDefaultEnum.java
rename to user/user-biz/src/main/java/cn/iocoder/mall/user/biz/enums/user/UserAddressHasDefaultEnum.java
index 7c43062d9..8306399b7 100644
--- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/enums/userAddress/UserAddressHasDefaultEnum.java
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/enums/user/UserAddressHasDefaultEnum.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.system.biz.enums.userAddress;
+package cn.iocoder.mall.user.biz.enums.user;
/**
* 用户地址 - 用户默认地址
@@ -9,7 +9,7 @@ package cn.iocoder.mall.system.biz.enums.userAddress;
public enum UserAddressHasDefaultEnum {
DEFAULT_ADDRESS_NO (1, "不是默认地址"),
- DEFAULT_ADDRESS_YES (2, "不是默认地址")
+ DEFAULT_ADDRESS_YES (2, "是默认地址")
;
private final int value;
diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/package-info.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/package-info.java
new file mode 100644
index 000000000..4f549a42f
--- /dev/null
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:27 下午
+ */
+package cn.iocoder.mall.user.biz;
\ No newline at end of file
diff --git a/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/package-info.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/package-info.java
new file mode 100644
index 000000000..343388589
--- /dev/null
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:30 下午
+ */
+package cn.iocoder.mall.user.biz.service;
\ No newline at end of file
diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserAddressService.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/user/UserAddressService.java
similarity index 67%
rename from system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserAddressService.java
rename to user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/user/UserAddressService.java
index 93aafbb57..659ea1f3d 100644
--- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserAddressService.java
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/user/UserAddressService.java
@@ -1,8 +1,8 @@
-package cn.iocoder.mall.system.biz.service.user;
+package cn.iocoder.mall.user.biz.service.user;
-import cn.iocoder.mall.system.biz.bo.user.UserAddressBO;
-import cn.iocoder.mall.system.biz.dto.user.UserAddressAddDTO;
-import cn.iocoder.mall.system.biz.dto.user.UserAddressUpdateDTO;
+import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
+import cn.iocoder.mall.user.biz.dto.user.UserAddressAddDTO;
+import cn.iocoder.mall.user.biz.dto.user.UserAddressUpdateDTO;
import java.util.List;
diff --git a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserAddressServiceImpl.java b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/user/UserAddressServiceImpl.java
similarity index 69%
rename from system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserAddressServiceImpl.java
rename to user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/user/UserAddressServiceImpl.java
index 2de40fb8c..111eecbbe 100644
--- a/system/system-biz/src/main/java/cn/iocoder/mall/system/biz/service/user/UserAddressServiceImpl.java
+++ b/user/user-biz/src/main/java/cn/iocoder/mall/user/biz/service/user/UserAddressServiceImpl.java
@@ -1,15 +1,15 @@
-package cn.iocoder.mall.system.biz.service.user;
+package cn.iocoder.mall.user.biz.service.user;
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
import cn.iocoder.mall.mybatis.enums.DeletedStatusEnum;
-import cn.iocoder.mall.system.biz.bo.user.UserAddressBO;
-import cn.iocoder.mall.system.biz.convert.user.UserAddressConvert;
-import cn.iocoder.mall.system.biz.dao.user.UserAddressMapper;
-import cn.iocoder.mall.system.biz.dataobject.user.UserAddressDO;
-import cn.iocoder.mall.system.biz.dto.user.UserAddressAddDTO;
-import cn.iocoder.mall.system.biz.dto.user.UserAddressUpdateDTO;
-import cn.iocoder.mall.system.biz.enums.userAddress.UserAddressHasDefaultEnum;
import cn.iocoder.mall.system.biz.enums.SystemErrorCodeEnum;
+import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
+import cn.iocoder.mall.user.biz.convert.user.UserAddressConvert;
+import cn.iocoder.mall.user.biz.dao.user.UserAddressMapper;
+import cn.iocoder.mall.user.biz.dataobject.user.UserAddressDO;
+import cn.iocoder.mall.user.biz.dto.user.UserAddressAddDTO;
+import cn.iocoder.mall.user.biz.dto.user.UserAddressUpdateDTO;
+import cn.iocoder.mall.user.biz.enums.user.UserAddressHasDefaultEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -38,13 +38,12 @@ public class UserAddressServiceImpl implements UserAddressService {
// 检查是否设置为默认地址
if (UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue() == userAddressAddDTO.getHasDefault()) {
- UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
- DeletedStatusEnum.DELETED_NO.getValue(),
- userAddressAddDTO.getUserId(), UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue());
+ UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(userAddressAddDTO.getUserId());
if (defaultUserAddress != null) {
- userAddressMapper.updateById(defaultUserAddress.getId(),
+ userAddressMapper.updateById(
new UserAddressDO()
+ .setId(defaultUserAddress.getId())
.setHasDefault(UserAddressHasDefaultEnum.DEFAULT_ADDRESS_NO.getValue())
);
}
@@ -55,9 +54,7 @@ public class UserAddressServiceImpl implements UserAddressService {
@Override
public void updateAddress(UserAddressUpdateDTO userAddressAddDTO) {
- UserAddressDO userAddress = userAddressMapper
- .selectByUserIdAndId(userAddressAddDTO.getUserId(), userAddressAddDTO.getId());
-
+ UserAddressDO userAddress = userAddressMapper.selectById(userAddressAddDTO.getId());
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
throw ServiceExceptionUtil.exception(SystemErrorCodeEnum.USER_ADDRESS_IS_DELETED.getCode());
}
@@ -68,37 +65,34 @@ public class UserAddressServiceImpl implements UserAddressService {
// 检查是否设置为默认地址
if (UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue() == userAddressAddDTO.getHasDefault()) {
- UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
- DeletedStatusEnum.DELETED_NO.getValue(),
- userAddressAddDTO.getUserId(), UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue());
+ UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(userAddressAddDTO.getUserId());
if (defaultUserAddress != null && !userAddressAddDTO.getId().equals(defaultUserAddress.getId())) {
- userAddressMapper.updateById(defaultUserAddress.getId(),
+ userAddressMapper.updateById(
new UserAddressDO()
+ .setId(defaultUserAddress.getId())
.setHasDefault(UserAddressHasDefaultEnum.DEFAULT_ADDRESS_NO.getValue())
);
}
}
- UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
- DeletedStatusEnum.DELETED_NO.getValue(),
- userAddressAddDTO.getUserId(), UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue());
-
+ UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(userAddressAddDTO.getUserId());
if (defaultUserAddress != null && !userAddressAddDTO.getId().equals(defaultUserAddress.getId())) {
- userAddressMapper.updateById(defaultUserAddress.getId(),
+ userAddressMapper.updateById(
new UserAddressDO()
+ .setId(defaultUserAddress.getId())
.setHasDefault(UserAddressHasDefaultEnum.DEFAULT_ADDRESS_NO.getValue())
);
}
UserAddressDO userAddressDO = UserAddressConvert.INSTANCE.convert(userAddressAddDTO);
userAddressDO.setUpdateTime(new Date());
- userAddressMapper.updateById(userAddressDO.getId(), userAddressDO);
+ userAddressMapper.updateById(userAddressDO);
}
@Override
public void removeAddress(Integer userId, Integer addressId) {
- UserAddressDO userAddress = userAddressMapper.selectByUserIdAndId(userId, addressId);
+ UserAddressDO userAddress = userAddressMapper.selectById(addressId);
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
// skip
@@ -110,16 +104,15 @@ public class UserAddressServiceImpl implements UserAddressService {
}
userAddressMapper.updateById(
- addressId,
(UserAddressDO) new UserAddressDO()
+ .setId(addressId)
.setDeleted(DeletedStatusEnum.DELETED_YES.getValue())
);
}
@Override
public List addressList(Integer userId) {
- List userAddressDOList = userAddressMapper
- .selectByUserIdAndDeleted(DeletedStatusEnum.DELETED_NO.getValue(), userId);
+ List userAddressDOList = userAddressMapper.selectByUserId(userId);
List userAddressBOList = UserAddressConvert
.INSTANCE.convertUserAddressBOList(userAddressDOList);
@@ -129,7 +122,7 @@ public class UserAddressServiceImpl implements UserAddressService {
@Override
public UserAddressBO getAddress(Integer userId, Integer id) {
- UserAddressDO userAddress = userAddressMapper.selectByUserIdAndId(userId, id);
+ UserAddressDO userAddress = userAddressMapper.selectById(id);
if (userAddress == null) {
throw ServiceExceptionUtil.exception(SystemErrorCodeEnum.USER_GET_ADDRESS_NOT_EXISTS.getCode());
}
@@ -144,12 +137,7 @@ public class UserAddressServiceImpl implements UserAddressService {
@Override
public UserAddressBO getDefaultAddress(Integer userId) {
-
- UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
- DeletedStatusEnum.DELETED_NO.getValue(),
- userId,
- UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue());
-
+ UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(userId);
return UserAddressConvert.INSTANCE.convert(defaultUserAddress);
}
}
diff --git a/user/user-rpc-api/pom.xml b/user/user-rpc-api/pom.xml
index 5943fb0af..9aa52648e 100644
--- a/user/user-rpc-api/pom.xml
+++ b/user/user-rpc-api/pom.xml
@@ -15,15 +15,19 @@
cn.iocoder.mall
- common-framework
+ system-biz-api
1.0-SNAPSHOT
-
+
javax.validation
validation-api
+
+ org.projectlombok
+ lombok
+
diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/api/user/UserAddressRPC.java b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/api/UserAddressRPC.java
similarity index 67%
rename from system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/api/user/UserAddressRPC.java
rename to user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/api/UserAddressRPC.java
index 77c2afc7e..cb58c1c4f 100644
--- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/api/user/UserAddressRPC.java
+++ b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/api/UserAddressRPC.java
@@ -1,8 +1,8 @@
-package cn.iocoder.mall.system.rpc.api.user;
+package cn.iocoder.mall.user.rpc.api;
-import cn.iocoder.mall.system.rpc.request.user.UserAddressAddRequest;
-import cn.iocoder.mall.system.rpc.request.user.UserAddressUpdateRequest;
-import cn.iocoder.mall.system.rpc.response.user.UserAddressResponse;
+import cn.iocoder.mall.user.rpc.request.user.UserAddressAddRequest;
+import cn.iocoder.mall.user.rpc.request.user.UserAddressUpdateRequest;
+import cn.iocoder.mall.user.rpc.response.user.UserAddressResponse;
import java.util.List;
diff --git a/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/package-info.java b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/package-info.java
new file mode 100644
index 000000000..4cfc41e4c
--- /dev/null
+++ b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:39 下午
+ */
+package cn.iocoder.mall.user.rpc;
\ No newline at end of file
diff --git a/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/request/package-info.java b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/request/package-info.java
new file mode 100644
index 000000000..1d2ebd408
--- /dev/null
+++ b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/request/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:41 下午
+ */
+package cn.iocoder.mall.user.rpc.request;
\ No newline at end of file
diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/user/UserAddressAddRequest.java b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/request/user/UserAddressAddRequest.java
similarity index 93%
rename from system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/user/UserAddressAddRequest.java
rename to user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/request/user/UserAddressAddRequest.java
index 50e0d507d..faa4b0756 100644
--- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/user/UserAddressAddRequest.java
+++ b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/request/user/UserAddressAddRequest.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.system.rpc.request.user;
+package cn.iocoder.mall.user.rpc.request.user;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/user/UserAddressUpdateRequest.java b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/request/user/UserAddressUpdateRequest.java
similarity index 93%
rename from system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/user/UserAddressUpdateRequest.java
rename to user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/request/user/UserAddressUpdateRequest.java
index ea6cd81af..ed9edfdf8 100644
--- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/request/user/UserAddressUpdateRequest.java
+++ b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/request/user/UserAddressUpdateRequest.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.system.rpc.request.user;
+package cn.iocoder.mall.user.rpc.request.user;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/response/package-info.java b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/response/package-info.java
new file mode 100644
index 000000000..80bdb0ae6
--- /dev/null
+++ b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/response/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:42 下午
+ */
+package cn.iocoder.mall.user.rpc.response;
\ No newline at end of file
diff --git a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/user/UserAddressResponse.java b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/response/user/UserAddressResponse.java
similarity index 93%
rename from system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/user/UserAddressResponse.java
rename to user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/response/user/UserAddressResponse.java
index 567b7799d..f5c38c901 100644
--- a/system/system-rpc-api/src/main/java/cn/iocoder/mall/system/rpc/response/user/UserAddressResponse.java
+++ b/user/user-rpc-api/src/main/java/cn/iocoder/mall/user/rpc/response/user/UserAddressResponse.java
@@ -1,4 +1,4 @@
-package cn.iocoder.mall.system.rpc.response.user;
+package cn.iocoder.mall.user.rpc.response.user;
import lombok.Data;
import lombok.experimental.Accessors;
diff --git a/user/user-rpc/pom.xml b/user/user-rpc/pom.xml
index 9fb14f0fb..d8dda724d 100644
--- a/user/user-rpc/pom.xml
+++ b/user/user-rpc/pom.xml
@@ -13,21 +13,16 @@
-
-
-
-
-
cn.iocoder.mall
user-rpc-api
1.0-SNAPSHOT
-
-
-
-
-
+
+ cn.iocoder.mall
+ user-biz
+ 1.0-SNAPSHOT
+
diff --git a/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/convert/package-info.java b/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/convert/package-info.java
new file mode 100644
index 000000000..31da5c336
--- /dev/null
+++ b/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/convert/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:43 下午
+ */
+package cn.iocoder.mall.user.rpc.convert;
\ No newline at end of file
diff --git a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/user/UserAddressRPCConvert.java b/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/convert/user/UserAddressRPCConvert.java
similarity index 58%
rename from system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/user/UserAddressRPCConvert.java
rename to user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/convert/user/UserAddressRPCConvert.java
index 681c974f9..16557408d 100644
--- a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/convert/user/UserAddressRPCConvert.java
+++ b/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/convert/user/UserAddressRPCConvert.java
@@ -1,12 +1,11 @@
-package cn.iocoder.mall.system.rpc.convert.user;
+package cn.iocoder.mall.user.rpc.convert.user;
-import cn.iocoder.mall.system.biz.bo.user.UserAddressBO;
-import cn.iocoder.mall.system.biz.dataobject.user.UserAddressDO;
-import cn.iocoder.mall.system.biz.dto.user.UserAddressAddDTO;
-import cn.iocoder.mall.system.biz.dto.user.UserAddressUpdateDTO;
-import cn.iocoder.mall.system.rpc.request.user.UserAddressAddRequest;
-import cn.iocoder.mall.system.rpc.request.user.UserAddressUpdateRequest;
-import cn.iocoder.mall.system.rpc.response.user.UserAddressResponse;
+import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
+import cn.iocoder.mall.user.biz.dto.user.UserAddressAddDTO;
+import cn.iocoder.mall.user.biz.dto.user.UserAddressUpdateDTO;
+import cn.iocoder.mall.user.rpc.request.user.UserAddressAddRequest;
+import cn.iocoder.mall.user.rpc.request.user.UserAddressUpdateRequest;
+import cn.iocoder.mall.user.rpc.response.user.UserAddressResponse;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
diff --git a/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/package-info.java b/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/package-info.java
new file mode 100644
index 000000000..878f636ef
--- /dev/null
+++ b/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:36 下午
+ */
+package cn.iocoder.mall.user.rpc;
\ No newline at end of file
diff --git a/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/rpc/package-info.java b/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/rpc/package-info.java
new file mode 100644
index 000000000..07960fd0d
--- /dev/null
+++ b/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/rpc/package-info.java
@@ -0,0 +1,5 @@
+/**
+ * author: sin
+ * time: 2020/5/3 8:37 下午
+ */
+package cn.iocoder.mall.user.rpc.rpc;
\ No newline at end of file
diff --git a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/rpc/user/UserAddressRPCImpl.java b/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/rpc/user/UserAddressRPCImpl.java
similarity index 76%
rename from system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/rpc/user/UserAddressRPCImpl.java
rename to user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/rpc/user/UserAddressRPCImpl.java
index 7c275627f..6feb5d39f 100644
--- a/system/system-rpc/src/main/java/cn/iocoder/mall/system/rpc/rpc/user/UserAddressRPCImpl.java
+++ b/user/user-rpc/src/main/java/cn/iocoder/mall/user/rpc/rpc/user/UserAddressRPCImpl.java
@@ -1,11 +1,11 @@
-package cn.iocoder.mall.system.rpc.rpc.user;
+package cn.iocoder.mall.user.rpc.rpc.user;
-import cn.iocoder.mall.system.biz.service.user.UserAddressService;
-import cn.iocoder.mall.system.rpc.api.user.UserAddressRPC;
-import cn.iocoder.mall.system.rpc.convert.user.UserAddressRPCConvert;
-import cn.iocoder.mall.system.rpc.request.user.UserAddressAddRequest;
-import cn.iocoder.mall.system.rpc.request.user.UserAddressUpdateRequest;
-import cn.iocoder.mall.system.rpc.response.user.UserAddressResponse;
+import cn.iocoder.mall.user.biz.service.user.UserAddressService;
+import cn.iocoder.mall.user.rpc.api.UserAddressRPC;
+import cn.iocoder.mall.user.rpc.convert.user.UserAddressRPCConvert;
+import cn.iocoder.mall.user.rpc.request.user.UserAddressAddRequest;
+import cn.iocoder.mall.user.rpc.request.user.UserAddressUpdateRequest;
+import cn.iocoder.mall.user.rpc.response.user.UserAddressResponse;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/user/user-rpc/src/main/resources/rpc.yaml b/user/user-rpc/src/main/resources/rpc.yaml
index 45f28657f..12748b6d6 100644
--- a/user/user-rpc/src/main/resources/rpc.yaml
+++ b/user/user-rpc/src/main/resources/rpc.yaml
@@ -15,3 +15,5 @@ dubbo:
filter: -exception
SystemLogRPC:
version: 1.0.0
+ UserAddressRPC:
+ version: 1.0.0