ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/dto/EnterpriseChargingDetailVO.java
@@ -59,6 +59,24 @@ @ApiModelProperty("Phone") private String phone; @ApiModelProperty("License plate") private String licensePlate; @ApiModelProperty("Charging capacity") private BigDecimal chargingCapacity; @ApiModelProperty("Electricity fee") private BigDecimal electrovalence; @ApiModelProperty("Service fee") private BigDecimal serviceCharge; @ApiModelProperty("Charging end mode") private Integer endMode; @ApiModelProperty("Accounting period count") private Integer periodCount; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private LocalDateTime createTime; ruoyi-service/ruoyi-order/src/main/resources/mapper/order/TChargingOrderMapper.xml
@@ -2848,6 +2848,12 @@ co.order_source AS orderSource, p.name AS partnerName, au.phone AS phone, car.license_plate AS licensePlate, co.charging_capacity AS chargingCapacity, IFNULL(price.electrovalence, 0) AS electrovalence, IFNULL(price.serviceCharge, 0) AS serviceCharge, co.end_mode AS endMode, IFNULL(price.periodCount, 0) AS periodCount, co.create_time AS createTime, co.start_time AS startTime, co.end_time AS endTime, @@ -2860,6 +2866,15 @@ LEFT JOIN charging_pile_service.t_charging_pile cp ON cp.id = co.charging_pile_id LEFT JOIN charging_pile_service.t_charging_gun cg ON cg.id = co.charging_gun_id LEFT JOIN charging_pile_account.t_app_user au ON au.id = co.app_user_id LEFT JOIN charging_pile_account.t_app_user_car car ON car.id = co.app_user_car_id LEFT JOIN ( SELECT charging_order_id, SUM(period_electric_price) AS electrovalence, SUM(period_service_price) AS serviceCharge, COUNT(1) AS periodCount FROM t_charging_order_accounting_strategy GROUP BY charging_order_id ) price ON price.charging_order_id = co.id </sql> <select id="enterpriseChargingDetail" resultType="com.ruoyi.order.dto.EnterpriseChargingDetailVO"> ruoyi-service/ruoyi-order/src/test/java/com/ruoyi/order/mapper/EnterpriseChargingDetailMapperTest.java
New file @@ -0,0 +1,38 @@ package com.ruoyi.order.mapper; import org.junit.jupiter.api.Test; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.stream.Collectors; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; class EnterpriseChargingDetailMapperTest { @Test void selectsExpectedChargingDetailColumns() 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 detailSelect = mapper.substring( mapper.indexOf("<sql id=\"enterpriseChargingDetailSelect\""), mapper.indexOf("<select id=\"enterpriseChargingDetail\"")); assertTrue(detailSelect.contains("AS licensePlate")); assertTrue(detailSelect.contains("AS chargingCapacity")); assertTrue(detailSelect.contains("AS electrovalence")); assertTrue(detailSelect.contains("AS serviceCharge")); assertTrue(detailSelect.contains("AS endMode")); assertTrue(detailSelect.contains("AS periodCount")); } }