| | |
| | | assertEquals(3, countOccurrences(refundQuery, "as site_id")); |
| | | } |
| | | |
| | | @Test |
| | | void specialRefundListSkipsUnrelatedOrderUnions() 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("WHERE re.refund_title = '特殊退款处理'")); |
| | | assertTrue(refundQuery.contains("<if test=\"data.specialRefund == null or !data.specialRefund\">")); |
| | | } |
| | | |
| | | private int countOccurrences(String text, String target) { |
| | | int count = 0; |
| | | int index = 0; |