<?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.xueyi.system.device.mapper.DmDeviceTenantMergeMapper">

    <select id="selectByDevId" parameterType="String" resultType="com.xueyi.system.api.device.domain.po.DmDeviceTenantMergePo">
        select * from dm_device_tenant_merge where dev_id = #{devId}
    </select>

    <select id="selectByDevSn" parameterType="String" resultType="com.xueyi.system.api.device.domain.po.DmDeviceTenantMergePo">
        select * from dm_device_tenant_merge where dev_sn = #{devSn}
    </select>

    <select id="selectSourceByTenantId" parameterType="Long" resultType="com.xueyi.tenant.api.source.domain.po.TeSourcePo">
        SELECT * FROM te_source  WHERE id = ( SELECT s.source_id FROM te_strategy s JOIN te_tenant t ON t.strategy_id=s.id AND t.id= #{tenantId})
    </select>
</mapper>