|
@@ -1,38 +0,0 @@
|
|
|
-package com.ylx.order.mapper;
|
|
|
|
|
-
|
|
|
|
|
-import org.junit.jupiter.api.Test;
|
|
|
|
|
-
|
|
|
|
|
-import java.io.InputStream;
|
|
|
|
|
-import java.nio.charset.StandardCharsets;
|
|
|
|
|
-
|
|
|
|
|
-import static org.junit.jupiter.api.Assertions.assertNotNull;
|
|
|
|
|
-import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
|
|
|
-
|
|
|
|
|
-public class TCommentUserMapperXmlTest {
|
|
|
|
|
-
|
|
|
|
|
- @Test
|
|
|
|
|
- public void merchantScoreStatisticsSqlReadsCommentScoreAndOrderCount() throws Exception {
|
|
|
|
|
- String xml = readMapperXml();
|
|
|
|
|
-
|
|
|
|
|
- assertTrue(xml.contains("selectMerchantScoreStatistics"));
|
|
|
|
|
- assertTrue(xml.contains("FROM"));
|
|
|
|
|
- assertTrue(xml.contains("t_comment_user c"));
|
|
|
|
|
- assertTrue(xml.contains("c.merchant_id = #{merchantId}"));
|
|
|
|
|
- assertTrue(xml.contains("c.is_delete = 0"));
|
|
|
|
|
- assertTrue(xml.contains("t_order o"));
|
|
|
|
|
- assertTrue(xml.contains("o.merchant_id = #{merchantId}"));
|
|
|
|
|
- assertTrue(xml.contains("o.is_delete = 0"));
|
|
|
|
|
- assertTrue(xml.contains("COALESCE(comment_stat.score_sum, 0) AS scoreSum"));
|
|
|
|
|
- assertTrue(xml.contains("COALESCE(order_stat.order_count, 0) AS orderCount"));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private String readMapperXml() throws Exception {
|
|
|
|
|
- try (InputStream inputStream = getClass().getClassLoader()
|
|
|
|
|
- .getResourceAsStream("mapper/order/TCommentUserMapper.xml")) {
|
|
|
|
|
- assertNotNull(inputStream, "TCommentUserMapper.xml should exist in test classpath");
|
|
|
|
|
- byte[] bytes = new byte[inputStream.available()];
|
|
|
|
|
- inputStream.read(bytes);
|
|
|
|
|
- return new String(bytes, StandardCharsets.UTF_8);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-}
|
|
|