shinnosuke
2026-08-21 bc2efbdb52190fe2e7be9920bbed6902d4ee28aa
talent-card-server/src/main/java/com/talentcard/server/service/MerchantDisplayPolicyAdminService.java
@@ -12,6 +12,7 @@
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;
@@ -53,7 +54,7 @@
        List<Map<String, Object>> records = merchantMapper.selectAdminPage(
                merchantId,
                clean(keyword),
                clean(merchantType),
                merchantTypeCode(merchantType),
                aliases,
                status,
                safeSize,
@@ -63,7 +64,7 @@
        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);
    }
@@ -177,6 +178,11 @@
        }
    }
    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;