diff --git a/dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/product/user/ProductUserQueryController.java b/dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/product/user/ProductUserQueryController.java index 1b5a6d5..9f3a044 100644 --- a/dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/product/user/ProductUserQueryController.java +++ b/dating-agency-mall-server/src/main/java/com/qniao/dam/api/query/product/user/ProductUserQueryController.java @@ -75,6 +75,12 @@ public class ProductUserQueryController { @GetMapping("get/product/by/customer/list") @ApiOperation("客户获取商品列表") public List getPageProductByCustomer() { - return productQueryService.getPageProductByCustomer(); + return productQueryService.getPageProductByCustomer(null); + } + + @GetMapping("get/product/by/customer/details") + @ApiOperation("客户获取商品详情") + public List getPageProductByCustomer(@RequestParam(value = "id",required = true) Long id,@RequestParam(value = "userId",required = false) Long userId) { + return productQueryService.getPageProductByCustomer(id); } } diff --git a/dating-agency-mall-server/src/main/java/com/qniao/dam/infrastructure/persistent/dao/view/ProductViewDao.java b/dating-agency-mall-server/src/main/java/com/qniao/dam/infrastructure/persistent/dao/view/ProductViewDao.java index 66091ff..bb4ac9e 100644 --- a/dating-agency-mall-server/src/main/java/com/qniao/dam/infrastructure/persistent/dao/view/ProductViewDao.java +++ b/dating-agency-mall-server/src/main/java/com/qniao/dam/infrastructure/persistent/dao/view/ProductViewDao.java @@ -26,7 +26,7 @@ public interface ProductViewDao { List pageProductByOperator(@Param("queryParam") UserPageProductByOperatorQueryParam queryParam); - List selectProductByCustomerList(); + List selectProductByCustomerList(@Param("id") Long id); IPage pageProductByMatchmaker(Page pageWithoutOrders, @Param("queryParam") UserPageProductByMatchmakerQueryParam queryParam); diff --git a/dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/ProductQueryService.java b/dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/ProductQueryService.java index 22652f5..2c60630 100644 --- a/dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/ProductQueryService.java +++ b/dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/ProductQueryService.java @@ -24,7 +24,9 @@ public interface ProductQueryService { ProductSpecTerm getTermByName(List productSpecTermList, ProductSpecTermNameEnum name); - List getPageProductByCustomer(); + List getPageProductByCustomer(Long id); + + UserPageProductByCustomerGroupVo getPageProductByCustomerDetails(Long id); IPage pageProductByMatchmaker(PageUtil pageUtil, UserPageProductByMatchmakerQueryParam queryParam); diff --git a/dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/impl/ProductQueryServiceImpl.java b/dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/impl/ProductQueryServiceImpl.java index 17c97a9..954cbc7 100644 --- a/dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/impl/ProductQueryServiceImpl.java +++ b/dating-agency-mall-server/src/main/java/com/qniao/dam/query/product/impl/ProductQueryServiceImpl.java @@ -118,9 +118,9 @@ public class ProductQueryServiceImpl implements ProductQueryService { } @Override - public List getPageProductByCustomer() { + public List getPageProductByCustomer(Long id) { List groupVoList = new ArrayList<>(); - List extendVos = productViewDao.selectProductByCustomerList(); + List extendVos = productViewDao.selectProductByCustomerList(id); Map> extMap = extendVos.stream().collect(Collectors.groupingBy(UserPageProductByCustomerExtendVo::getId)); extMap.forEach((k, v) -> { UserPageProductByCustomerExtendVo extendVo = v.get(0); @@ -139,6 +139,15 @@ public class ProductQueryServiceImpl implements ProductQueryService { return groupVoList; } + @Override + public UserPageProductByCustomerGroupVo getPageProductByCustomerDetails(Long id) { + List vos = getPageProductByCustomer(id); + if(!vos.isEmpty()){ + return vos.get(0); + } + return new UserPageProductByCustomerGroupVo(); + } + /** * 找出对应name的value diff --git a/dating-agency-mall-server/src/main/resources/mapper/product/WalletAccountAssociateOrderRecordDao.xml b/dating-agency-mall-server/src/main/resources/mapper/product/WalletAccountAssociateOrderRecordDao.xml index 99cca0e..545dba8 100644 --- a/dating-agency-mall-server/src/main/resources/mapper/product/WalletAccountAssociateOrderRecordDao.xml +++ b/dating-agency-mall-server/src/main/resources/mapper/product/WalletAccountAssociateOrderRecordDao.xml @@ -95,6 +95,9 @@ LEFT JOIN da_product_spec_term as dpst3 on dpst3.is_delete=0 and dpst3.product_spec_id =ps.id and dpst3.`name`=2 LEFT JOIN da_product_spec_term as dpst4 on dpst4.is_delete=0 and dpst4.product_spec_id =ps.id and dpst4.`name`=4 WHERE a.is_delete = 0 AND a.status = 1 AND a.start_time <= NOW() AND a.end_time >= NOW() + + AND a.id = #{id} + UNION select 0 groupType, @@ -120,6 +123,9 @@ LEFT JOIN da_product_spec_term as dpst3 on dpst3.is_delete=0 and dpst3.product_spec_id =dps.id and dpst3.`name`=2 LEFT JOIN da_product_spec_term as dpst4 on dpst4.is_delete=0 and dpst4.product_spec_id =dps.id and dpst4.`name`=4 where dp.is_delete=0 and dp.`status`=1 and dp.product_type=2 + + AND dp.id = #{id} +