release: 复原省市区取值方式

release-2024-04-25
huangyw 3 months ago
parent 2f879711a3
commit 388881ebfd

@ -25,22 +25,13 @@ public class UserinfoShippingAddressAddDTO implements Serializable {
Integer acquiesce;
@ApiModelProperty(value = "省")
String provinceName;
Integer provinceId;
@ApiModelProperty(value = "市")
String cityName;
Integer cityId;
@ApiModelProperty(value = "区")
String districtName;
@ApiModelProperty(value = "省编码")
String provinceCode;
@ApiModelProperty(value = "市编码")
String cityCode;
@ApiModelProperty(value = "区编码")
String districtCode;
Integer districtId;
@ApiModelProperty(value = "收货人")
String consignee;

@ -30,22 +30,13 @@ public class UserinfoShippingAddressUpdateDTO implements Serializable {
Integer acquiesce;
@ApiModelProperty(value = "省")
String provinceName;
Integer provinceId;
@ApiModelProperty(value = "市")
String cityName;
Integer cityId;
@ApiModelProperty(value = "区")
String districtName;
@ApiModelProperty(value = "省编码")
String provinceCode;
@ApiModelProperty(value = "市编码")
String cityCode;
@ApiModelProperty(value = "区编码")
String districtCode;
Integer districtId;
@ApiModelProperty(value = "收货人")
String consignee;

@ -40,22 +40,13 @@ public class UserinfoShippingAddress extends JPABasePojo {
private String userId;
@ApiModelProperty(value = "省")
private String provinceName;
private Integer provinceId;
@ApiModelProperty(value = "市")
private String cityName;
private Integer cityId;
@ApiModelProperty(value = "区")
private String districtName;
@ApiModelProperty(value = "省编码")
private String provinceCode;
@ApiModelProperty(value = "市编码")
private String cityCode;
@ApiModelProperty(value = "区编码")
private String districtCode;
private Integer districtId;
@ApiModelProperty(value = "收货人")
private String consignee;

@ -56,19 +56,24 @@ public class UserinfoShippingAddressService {
QUserinfoShippingAddress qUserinfoShippingAddress = QUserinfoShippingAddress.userinfoShippingAddress;
return jpaQueryFactory.select(Projections.constructor(UserinfoShippingAddressAppVO.class,
List<UserinfoShippingAddressAppVO> fetch = jpaQueryFactory.select(Projections.constructor(UserinfoShippingAddressAppVO.class,
qUserinfoShippingAddress.id,
qUserinfoShippingAddress.address,
qUserinfoShippingAddress.acquiesce,
qUserinfoShippingAddress.provinceName,
qUserinfoShippingAddress.cityName,
qUserinfoShippingAddress.districtName,
qUserinfoShippingAddress.provinceCode,
qUserinfoShippingAddress.cityCode,
qUserinfoShippingAddress.districtCode
qUserinfoShippingAddress.provinceId,
qUserinfoShippingAddress.cityId,
qUserinfoShippingAddress.districtId,
qUserinfoShippingAddress.consignee,
qUserinfoShippingAddress.phone
)).from(qUserinfoShippingAddress).
where(qUserinfoShippingAddress.userId.eq(user.getUserId()))
.fetch();
fetch.forEach(item -> {
item.setProvinceRegion(item.getProvinceId() != null ? regionDao.getOne(item.getProvinceId()) : null);
item.setCityRegion(item.getCityId() != null ? regionDao.getOne(item.getCityId()) : null);
item.setDistrictRegion(item.getDistrictId() != null ? regionDao.getOne(item.getDistrictId()) : null);
});
return fetch;
}
@Transactional(rollbackFor = Exception.class)

@ -28,22 +28,13 @@ public class UserinfoShippingAddressAppVO implements Serializable {
Integer acquiesce;
@ApiModelProperty(value = "省")
String provinceName;
Integer provinceId;
@ApiModelProperty(value = "市")
String cityName;
Integer cityId;
@ApiModelProperty(value = "区")
String districtName;
@ApiModelProperty(value = "省编码")
String provinceCode;
@ApiModelProperty(value = "市编码")
String cityCode;
@ApiModelProperty(value = "区编码")
String districtCode;
Integer districtId;
@ApiModelProperty(value = "收货人")
String consignee;
@ -51,4 +42,23 @@ public class UserinfoShippingAddressAppVO implements Serializable {
@ApiModelProperty(value = "联系电话")
String phone;
@ApiModelProperty(value = "省")
Region provinceRegion;
@ApiModelProperty(value = "市")
Region cityRegion;
@ApiModelProperty(value = "区")
Region districtRegion;
public UserinfoShippingAddressAppVO(String id, String address, Integer acquiesce, Integer provinceId, Integer cityId, Integer districtId, String consignee, String phone) {
this.id = id;
this.address = address;
this.acquiesce = acquiesce;
this.provinceId = provinceId;
this.cityId = cityId;
this.districtId = districtId;
this.consignee = consignee;
this.phone = phone;
}
}

@ -0,0 +1,27 @@
alter table tb_userinfo_shipping_address
drop column province_name;
alter table tb_userinfo_shipping_address
drop column city_name;
alter table tb_userinfo_shipping_address
drop column district_name;
alter table tb_userinfo_shipping_address
add province_id int null comment '省id';
alter table tb_userinfo_shipping_address
add city_id int null comment '市id';
alter table tb_userinfo_shipping_address
drop column province_code;
alter table tb_userinfo_shipping_address
drop column city_code;
alter table tb_userinfo_shipping_address
add district_id int null comment '区id';
alter table tb_userinfo_shipping_address
drop column district_code;
Loading…
Cancel
Save