wenminjie
2026-08-05 f130d019f4315af0225497d8d7f4e1b87e1e5bbc
talent-card-server/src/main/java/com/talentcard/server/business/portal/PortalService.java
@@ -291,7 +291,13 @@
   @Transactional(readOnly = true)
   public PageResult<Map<String, Object>> stayMerchants(String type, int page, int size) {
      if (!List.of("hotel", "apartment").contains(type)) throw new BusinessException(ErrorCode.BAD_REQUEST, "不支持的住宿服务类型");
      String requestedType = type == null ? "" : type.trim();
      String merchantType = switch (requestedType) {
         case "hotel", "酒店服务" -> "酒店服务";
         case "apartment", "公寓租赁服务" -> "公寓租赁服务";
         default -> throw new BusinessException(ErrorCode.BAD_REQUEST, "不支持的住宿服务类型");
      };
      String responseMerchantType = merchantType.equals("公寓租赁服务") ? "apartment" : "hotel";
      String merchantWhere = " where deleted = 0 and merchant_type = ?";
      PageResult<Map<String, Object>> result = page("""
            select id, merchant_name, merchant_type, contact_name, contact_mobile, logo_url, cover_url, address,
@@ -300,8 +306,12 @@
                   (select min(p.original_price) from merchant_product p where p.merchant_id = merchant.id and p.deleted = 0 and p.status = 1 and p.audit_status = 2) as original_price
            from merchant
            """ + merchantWhere + " order by sort_no asc, id asc",
            "select count(*) from merchant" + merchantWhere, page, size, type);
      List<Map<String, Object>> records = result.records().stream().map(this::enrichMerchantSearchRow).toList();
            "select count(*) from merchant" + merchantWhere, page, size, merchantType);
      List<Map<String, Object>> records = result.records().stream().map(row -> {
         Map<String, Object> normalized = new LinkedHashMap<>(row);
         normalized.put("merchantType", responseMerchantType);
         return enrichMerchantSearchRow(normalized);
      }).toList();
      return new PageResult<>(records, result.page(), result.size(), result.total());
   }