<?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.zsElectric.boot.business.mapper.FirmStationTimePriceMapper">

    <!-- 获取企业专属价格分页列表 -->
    <select id="getFirmStationTimePricePage" resultType="com.zsElectric.boot.business.model.vo.FirmStationTimePriceVO">
        SELECT
                id,
                firm_price,
                service_price,
                station_id,
                time,
                firm_id,
                create_time,
                create_by,
                update_time,
                update_by,
                is_deleted
        FROM
            c_firm_station_time_price
        <where>
        </where>
    </select>

    <select id="getExclusivePriceList" resultType="com.zsElectric.boot.business.model.dto.ExclusivePriceDTO">
        SELECT
            stp.`time`,
            stp.add_service_price addServicePrice,
            stp.electrovalence,
            stp.service_price servicePrice,
            stp.e_price ePrice,
            stp.time_type timeType,
            fstp.id,
            ifnull( fstp.service_price, 0 ) firmServicePrice,
            fstp.firm_price AS firmPrice
        FROM
            c_station_time_price stp
                LEFT JOIN c_firm_station_time_price fstp ON stp.station_id = fstp.station_id
                AND stp.TIME = fstp.TIME
                AND fstp.firm_id = #{firmId}
        WHERE
            stp.is_deleted = 0
          AND stp.is_deleted = 0
          AND stp.station_id = #{stationId}
    </select>

</mapper>
