From 944b8be3e1c267293e81b64b73b5a89811cab44e Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Fri, 6 Sep 2024 08:40:47 +0800 Subject: [PATCH] =?UTF-8?q?release:=20=E9=97=A8=E5=BA=97PC=E7=AB=AF?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../luoo/user/controller/StoreController.java | 2 +- .../com/luoo/user/service/StoreService.java | 32 +++++++++++++++++-- 2 files changed, 31 insertions(+), 3 deletions(-) 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) {