Pu Zhibing
2024-10-16 c4664502dfdaffff555b532e65b51a57ac8b29c2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.chargingPile.mapper.TAccountingStrategyDetailMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.chargingPile.api.model.TAccountingStrategyDetail">
        <id column="id" property="id" />
        <result column="accounting_strategy_id" property="accountingStrategyId" />
        <result column="`type`" property="type" />
        <result column="start_time" property="startTime" />
        <result column="end_time" property="endTime" />
        <result column="electrovalence" property="electrovalence" />
        <result column="service_charge" property="serviceCharge" />
        <result column="cost_service_charge" property="costServiceCharge" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, accounting_strategy_id, `type`, start_time, end_time, electrovalence, service_charge, cost_service_charge
    </sql>
    <select id="queryAccountingStrategyDetailByStrategyId" resultType="com.ruoyi.chargingPile.api.vo.TAccountingStrategyDetailVO">
        SELECT
            tasd.id, tasd.accounting_strategy_id, tasd.`type`, tasd.start_time, tasd.end_time, ROUND(tasd.electrovalence,4) AS electrovalence,
            ROUND(tasd.service_charge,4) AS serviceCharge,ROUND(tasd.cost_service_charge,4) AS costServiceCharge,tas.discount
        FROM t_accounting_strategy_detail tasd
        LEFT JOIN t_accounting_strategy tas ON tas.id = tasd.accounting_strategy_id
        <where>
            <if test="strategyId != null">
                AND tasd.accounting_strategy_id = #{strategyId}
            </if>
        </where>
    </select>
 
</mapper>