diff --git a/luoo_user/src/main/java/com/luoo/user/dto/userinfo/UserinfoShippingAddressAddDTO.java b/luoo_user/src/main/java/com/luoo/user/dto/userinfo/UserinfoShippingAddressAddDTO.java index 063e968..b92a79d 100644 --- a/luoo_user/src/main/java/com/luoo/user/dto/userinfo/UserinfoShippingAddressAddDTO.java +++ b/luoo_user/src/main/java/com/luoo/user/dto/userinfo/UserinfoShippingAddressAddDTO.java @@ -24,14 +24,17 @@ public class UserinfoShippingAddressAddDTO implements Serializable { @ApiModelProperty(value = "是否默认地址 1-是 2-否") Integer acquiesce; - @ApiModelProperty(value = "省份id") - Integer provinceId; + @ApiModelProperty(value = "省") + String provinceName; - @ApiModelProperty(value = "城市id") - Integer cityId; + @ApiModelProperty(value = "市") + String cityName; - @ApiModelProperty(value = "县区id") - Integer districtId; + @ApiModelProperty(value = "区") + String districtName; + + @ApiModelProperty(value = "区域编码") + String adcode; } \ No newline at end of file diff --git a/luoo_user/src/main/java/com/luoo/user/dto/userinfo/UserinfoShippingAddressUpdateDTO.java b/luoo_user/src/main/java/com/luoo/user/dto/userinfo/UserinfoShippingAddressUpdateDTO.java index ac64d64..88b455c 100644 --- a/luoo_user/src/main/java/com/luoo/user/dto/userinfo/UserinfoShippingAddressUpdateDTO.java +++ b/luoo_user/src/main/java/com/luoo/user/dto/userinfo/UserinfoShippingAddressUpdateDTO.java @@ -29,13 +29,16 @@ public class UserinfoShippingAddressUpdateDTO implements Serializable { @ApiModelProperty(value = "是否默认地址 1-是 2-否") Integer acquiesce; - @ApiModelProperty(value = "省份id") - Integer provinceId; + @ApiModelProperty(value = "省") + String provinceName; - @ApiModelProperty(value = "城市id") - Integer cityId; + @ApiModelProperty(value = "市") + String cityName; - @ApiModelProperty(value = "县区id") - Integer districtId; + @ApiModelProperty(value = "区") + String districtName; + + @ApiModelProperty(value = "区域编码") + String adcode; } \ No newline at end of file diff --git a/luoo_user/src/main/java/com/luoo/user/pojo/UserinfoShippingAddress.java b/luoo_user/src/main/java/com/luoo/user/pojo/UserinfoShippingAddress.java index 62513f7..d5abdc8 100644 --- a/luoo_user/src/main/java/com/luoo/user/pojo/UserinfoShippingAddress.java +++ b/luoo_user/src/main/java/com/luoo/user/pojo/UserinfoShippingAddress.java @@ -39,13 +39,16 @@ public class UserinfoShippingAddress extends JPABasePojo { @ApiModelProperty(value = "用户id") private String userId; - @ApiModelProperty(value = "省份id") - private Integer provinceId; + @ApiModelProperty(value = "省") + private String provinceName; - @ApiModelProperty(value = "城市id") - private Integer cityId; + @ApiModelProperty(value = "市") + private String cityName; - @ApiModelProperty(value = "县区id") - private Integer districtId; + @ApiModelProperty(value = "区") + private String districtName; + + @ApiModelProperty(value = "区域编码") + private String adcode; } diff --git a/luoo_user/src/main/java/com/luoo/user/service/UserinfoShippingAddressService.java b/luoo_user/src/main/java/com/luoo/user/service/UserinfoShippingAddressService.java index 7145f7c..4d359f5 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/UserinfoShippingAddressService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/UserinfoShippingAddressService.java @@ -56,22 +56,17 @@ public class UserinfoShippingAddressService { QUserinfoShippingAddress qUserinfoShippingAddress = QUserinfoShippingAddress.userinfoShippingAddress; - List fetch = jpaQueryFactory.select(Projections.constructor(UserinfoShippingAddressAppVO.class, + return jpaQueryFactory.select(Projections.constructor(UserinfoShippingAddressAppVO.class, qUserinfoShippingAddress.id, qUserinfoShippingAddress.address, qUserinfoShippingAddress.acquiesce, - qUserinfoShippingAddress.provinceId, - qUserinfoShippingAddress.cityId, - qUserinfoShippingAddress.districtId + qUserinfoShippingAddress.provinceName, + qUserinfoShippingAddress.cityName, + qUserinfoShippingAddress.districtName, + qUserinfoShippingAddress.adcode )).from(qUserinfoShippingAddress). where(qUserinfoShippingAddress.userId.eq(user.getUserId())) .fetch(); - fetch.forEach(item -> { - item.setProvinceRegion(item.getProvinceId() == null ? null : regionDao.getOne(item.getProvinceId())); - item.setCityRegion(item.getCityId() == null ? null : regionDao.getOne(item.getCityId())); - item.setDistrictRegion(item.getDistrictRegion() == null ? null : regionDao.getOne(item.getDistrictId())); - }); - return fetch; } @Transactional(rollbackFor = Exception.class) diff --git a/luoo_user/src/main/java/com/luoo/user/vo/userinfo/UserinfoShippingAddressAppVO.java b/luoo_user/src/main/java/com/luoo/user/vo/userinfo/UserinfoShippingAddressAppVO.java index 6c4b029..497c69f 100644 --- a/luoo_user/src/main/java/com/luoo/user/vo/userinfo/UserinfoShippingAddressAppVO.java +++ b/luoo_user/src/main/java/com/luoo/user/vo/userinfo/UserinfoShippingAddressAppVO.java @@ -27,30 +27,16 @@ public class UserinfoShippingAddressAppVO implements Serializable { @ApiModelProperty(value = "是否默认地址 1-是 2-否") Integer acquiesce; - @ApiModelProperty(value = "省份id") - Integer provinceId; + @ApiModelProperty(value = "省") + String provinceName; - @ApiModelProperty(value = "城市id") - Integer cityId; + @ApiModelProperty(value = "市") + String cityName; - @ApiModelProperty(value = "县区id") - Integer districtId; + @ApiModelProperty(value = "区") + String districtName; - @ApiModelProperty(value = "省份") - Region provinceRegion; + @ApiModelProperty(value = "区域编码") + String adcode; - @ApiModelProperty(value = "城市") - Region cityRegion; - - @ApiModelProperty(value = "县区") - Region districtRegion; - - public UserinfoShippingAddressAppVO(String id, String address, Integer acquiesce, Integer provinceId, Integer cityId, Integer districtId) { - this.id = id; - this.address = address; - this.acquiesce = acquiesce; - this.provinceId = provinceId; - this.cityId = cityId; - this.districtId = districtId; - } } diff --git a/luoo_user/src/main/resources/sql/20241103.sql b/luoo_user/src/main/resources/sql/20241103.sql new file mode 100644 index 0000000..c501da6 --- /dev/null +++ b/luoo_user/src/main/resources/sql/20241103.sql @@ -0,0 +1,20 @@ +alter table tb_userinfo_shipping_address +drop column province_id; + +alter table tb_userinfo_shipping_address + add province_name varchar(30) null comment '省'; + +alter table tb_userinfo_shipping_address +drop column city_id; + +alter table tb_userinfo_shipping_address + add city_name varchar(30) null comment '市'; + +alter table tb_userinfo_shipping_address +drop column district_id; + +alter table tb_userinfo_shipping_address + add district_name varchar(30) null comment '区'; + +alter table tb_userinfo_shipping_address + add adcode varchar(30) null comment '区域码'; \ No newline at end of file