diff --git a/luoo_user/src/main/java/com/luoo/user/controller/StoreController.java b/luoo_user/src/main/java/com/luoo/user/controller/StoreController.java index 4a6b69c..e04b5af 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/StoreController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/StoreController.java @@ -65,7 +65,7 @@ public class StoreController { @GetMapping("/get") @GlobalInterceptor(checkAdminLogin = true) @ApiOperation(value = "获取门店详情(PC)", notes = "获取门店详情") - public Result getStore(String id) { + public Result getStore(String id) { return Result.success(storeService.getOne(id)); } diff --git a/luoo_user/src/main/java/com/luoo/user/service/StoreService.java b/luoo_user/src/main/java/com/luoo/user/service/StoreService.java index 8cb5b6b..eea280d 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/StoreService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/StoreService.java @@ -99,8 +99,36 @@ public class StoreService { storeDao.save(oldStore); } - public Store getOne(String id) { - return storeDao.findById(id).orElse(null); + public StorePCVO getOne(String id) { + QStore qStore = QStore.store; + QUserInfo qUserInfo = QUserInfo.userInfo; + return jpaQueryFactory.select(Projections.constructor(StorePCVO.class, + qStore.id, + qStore.name, + qStore.regionId, + qStore.address, + qStore.lng, + qStore.lat, + qStore.contact, + qStore.phone, + qStore.tel, + qStore.openingHours, + qStore.background, + qStore.description, + qStore.createTime, + qStore.status, + qStore.visitCount, + qUserInfo.avatar.as("contactAvatar"), + qUserInfo.nickName.as("contactNickName"), + qStore.introduction, + qStore.code, + qStore.discount, + qStore.discountDescription + )).from(qStore) + .leftJoin(qUserInfo) + .on(qStore.contact.eq(qUserInfo.id)) + .where((qStore.id.eq(id))) + .fetchOne(); } public StoreAppVO getStoreForApp(String id) {