release- 收货地址修改为省市区字符串+adcode

release-2024-04-25
huangyw 3 months ago
parent 13012f5a10
commit 007bc3dcf0

@ -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;
}

@ -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;
}

@ -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;
}

@ -56,22 +56,17 @@ public class UserinfoShippingAddressService {
QUserinfoShippingAddress qUserinfoShippingAddress = QUserinfoShippingAddress.userinfoShippingAddress;
List<UserinfoShippingAddressAppVO> 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)

@ -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;
}
}

@ -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 '区域码';
Loading…
Cancel
Save