| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.talentcard.server.business.PageResult; |
| | | import com.talentcard.server.business.merchant.MerchantTypeCatalog; |
| | | import com.talentcard.server.common.BusinessException; |
| | | import com.talentcard.server.common.ErrorCode; |
| | | import com.talentcard.server.entity.MerchantCardBenefit; |
| | |
| | | List<Map<String, Object>> records = merchantMapper.selectAdminPage( |
| | | merchantId, |
| | | clean(keyword), |
| | | clean(merchantType), |
| | | merchantTypeCode(merchantType), |
| | | aliases, |
| | | status, |
| | | safeSize, |
| | |
| | | List<Map<String, Object>> views = records.stream() |
| | | .map(row -> adminView(row, benefits.getOrDefault(longValue(row, "merchantId"), List.of()))) |
| | | .toList(); |
| | | Long total = merchantMapper.countAdminPage(merchantId, clean(keyword), clean(merchantType), aliases, status); |
| | | Long total = merchantMapper.countAdminPage(merchantId, clean(keyword), merchantTypeCode(merchantType), aliases, status); |
| | | return new PageResult<>(views, safePage, safeSize, total == null ? 0 : total); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private String merchantTypeCode(String value) { |
| | | String cleaned = clean(value); |
| | | return cleaned.isBlank() ? "" : MerchantTypeCatalog.canonicalCode(cleaned); |
| | | } |
| | | |
| | | private void upsertPolicies(Long merchantId, List<MerchantDisplayPolicySaveRequest.CardPolicy> policies) { |
| | | if (policies == null) { |
| | | return; |