liujie
2026-07-21 5bc349b0321d6058ea859780de6d1bd5a0ffdb35
ruoyi-service/ruoyi-order/src/test/java/com/ruoyi/order/mapper/PayOrderQueryPerformanceMapperTest.java
@@ -12,6 +12,7 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
class PayOrderQueryPerformanceMapperTest {
@@ -35,6 +36,25 @@
        assertFalse(payOrderQuery.contains("t_vip_order_refund"));
    }
    @Test
    void refundListAppliesPartnerSiteScopeInsidePagedQuery() throws IOException {
        InputStream input = getClass().getClassLoader()
                .getResourceAsStream("mapper/order/TChargingOrderMapper.xml");
        assertNotNull(input);
        String mapper;
        try (BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))) {
            mapper = reader.lines().collect(Collectors.joining("\n"));
        }
        String refundQuery = mapper.substring(
                mapper.indexOf("<select id=\"getRefundList\""),
                mapper.indexOf("<select id=\"chargingOrderGroup\""));
        assertTrue(refundQuery.contains("data.siteIds"));
        assertTrue(refundQuery.contains("o.site_id IN"));
        assertEquals(3, countOccurrences(refundQuery, "as site_id"));
    }
    private int countOccurrences(String text, String target) {
        int count = 0;
        int index = 0;