<?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.fjhx.iot.mapper.tda.TdaDeviceMapper">
    <select id="getPage" resultType="com.fjhx.iot.entity.tda.vo.TdaDeviceVo">
        SELECT td.id,
               td.device_id,
               td.device_name,
               td.device_code,
               td.device_spec,
               td.device_delivery_time,
               td.maker_name,
               td.maker_phone,
               td.remark,
               td.create_user,
               td.create_time,
               td.update_user,
               td.update_time,
               td.company_id,
               td.prod_mode,
               td.prod_task_id,
               td.user_uuid
        FROM tda_device td
            ${ew.customSqlSegment}
    </select>
    <select id="detail" resultType="com.fjhx.iot.entity.tda.vo.TdaDeviceVo">
        SELECT td.*,
               pod.product_id,
               po.`code` AS orderCode
        FROM tda_device td
                 LEFT JOIN production_order_detail pod ON td.prod_task_id = pod.id
                 LEFT JOIN production_order po ON pod.produce_order_id = po.id
            ${ew.customSqlSegment}
    </select>

</mapper>
