|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.luoo.user.service;
|
|
|
|
|
|
|
|
|
|
import com.luoo.user.dao.RegionDao;
|
|
|
|
|
import com.luoo.user.dao.UserinfoShippingAddressDao;
|
|
|
|
|
import com.luoo.user.dto.userinfo.UserinfoShippingAddressAddDTO;
|
|
|
|
|
import com.luoo.user.dto.userinfo.UserinfoShippingAddressUpdateDTO;
|
|
|
|
@ -35,11 +36,14 @@ public class UserinfoShippingAddressService {
|
|
|
|
|
|
|
|
|
|
private final JPAQueryFactory jpaQueryFactory;
|
|
|
|
|
|
|
|
|
|
public UserinfoShippingAddressService(JwtUtil jwtUtil, IdWorker idWorker, UserinfoShippingAddressDao userinfoShippingAddressDao, JPAQueryFactory jpaQueryFactory) {
|
|
|
|
|
private final RegionDao regionDao;
|
|
|
|
|
|
|
|
|
|
public UserinfoShippingAddressService(JwtUtil jwtUtil, IdWorker idWorker, UserinfoShippingAddressDao userinfoShippingAddressDao, JPAQueryFactory jpaQueryFactory, RegionDao regionDao) {
|
|
|
|
|
this.jwtUtil = jwtUtil;
|
|
|
|
|
this.idWorker = idWorker;
|
|
|
|
|
this.userinfoShippingAddressDao = userinfoShippingAddressDao;
|
|
|
|
|
this.jpaQueryFactory = jpaQueryFactory;
|
|
|
|
|
this.regionDao = regionDao;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -52,13 +56,22 @@ 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.acquiesce,
|
|
|
|
|
qUserinfoShippingAddress.provinceId,
|
|
|
|
|
qUserinfoShippingAddress.cityId,
|
|
|
|
|
qUserinfoShippingAddress.districtId
|
|
|
|
|
)).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)
|
|
|
|
|