<?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.interplug.qcast.biz.trestle.TrestleInfoMapper">
    <select id="getTrestlesByRoofMaterialId" parameterType="integer"
            resultType="com.interplug.qcast.biz.trestle.dto.TrestleInfoResponse">
        SELECT A.TRESTLE_ID AS ID
             , B.NAME       AS NAME
             , C.ID         AS MANUFACTURERID
             , C.NAME       AS MANUFACTURERNAME
          FROM TB_MAP_ROOF_MATERIAL_TRESTLE A
          JOIN TB_TRESTLE B
            ON A.TRESTLE_ID = B.ID
          JOIN TB_MANUFACTURER C
            ON B.MANUFACTURER_ID = C.ID
         WHERE A.ROOF_MATERIAL_ID = #{roofMaterialId}
    </select>
</mapper>