<?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.njcn.quality.mapper.EleRateSetMappser">
    <select id="getEleRateDetail" resultType="EleRateVO">
        SELECT
            dic.id rateTypeId,
            dic.NAME rateTypeName,
            COALESCE(rate.time,'-') rateTypeTime,
            COALESCE(rate.rate,'-') rate
        FROM
            sys_dict_data dic
        LEFT JOIN
            ele_rate_set rate ON dic.Id = rate.Id
        INNER JOIN
            sys_dict_type type on dic.Type_Id = type.Id
        WHERE
            type.name =#{typeName}
        ORDER BY
            dic.sort
    </select>

    <select id="getEleRateById" resultType="EleRateVO">
        SELECT
            dic.id rateTypeId,
            dic.NAME rateTypeName,
            COALESCE(rate.time,'-') rateTypeTime,
            COALESCE(rate.rate,'-') rate
        FROM
            sys_dict_data dic
        LEFT JOIN
            ele_rate_set rate ON dic.Id = rate.Id
        WHERE dic.id = #{id}
    </select>
</mapper>
