<?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.EmsDeviceItemCodeMapper">

    <select id="selectDeviceUuidsByItemCode" resultType="java.lang.String">
        SELECT DISTINCT ic.device_uuid AS device_uuid
        FROM ems_device_item_code ic
        INNER JOIN dmp_device d ON d.device_uuid = ic.device_uuid
        WHERE ic.item_code = #{itemCode}
          AND d.delete_flag = 0
          AND d.tenant_id = #{tenantId}
          AND d.device_uuid IS NOT NULL
          AND d.device_uuid != ''
    </select>

</mapper>
