<?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.usky.ems.mapper.DmpProductMapper">

    <select id="selectProductCodesByEnergyType" resultType="java.lang.String">
        SELECT dp.product_code
        FROM dmp_product dp
        INNER JOIN ems_product_energy_type ep ON dp.id = ep.product_id
        WHERE dp.tenant_id = #{tenantId}
          AND dp.delete_flag = 0
          AND dp.product_code IS NOT NULL
          AND dp.product_code != ''
        <if test="energyType != null">
            AND ep.energy_type = #{energyType}
        </if>
    </select>

</mapper>
