<?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.mes.mapper.production.ProductionTaskMapper">
    <select id="getPage" resultType="com.fjhx.mes.entity.production.vo.ProductionTaskVo">
        SELECT
            pt.id,
            pt.production_plan_id,
            pt.CODE,
            pt.quantity,
            pt.person_liable_id,
            pt.STATUS,
            pt.due_date,
            pt.create_user,
            pt.create_time,
            pt.update_user,
            pt.update_time,
            wo.product_id
        FROM
            production_task pt
                LEFT JOIN production_plan pp ON pt.production_plan_id = pp.id
                LEFT JOIN work_order wo ON pp.work_order_id = wo.id
            ${ew.customSqlSegment}
    </select>
    <select id="detail" resultType="com.fjhx.mes.entity.production.vo.ProductionTaskVo">
        SELECT
            pt.*,
            wo.product_id
        FROM
            production_task pt
                LEFT JOIN production_plan pp ON pt.production_plan_id = pp.id
                LEFT JOIN work_order wo ON pp.work_order_id = wo.id
        WHERE
            pt.id = #{id}
    </select>
    <select id="myListByIds" resultType="com.fjhx.mes.entity.production.vo.ProductionTaskVo">
        SELECT
            pt.*,
            wo.product_id
        FROM
            production_task pt
                LEFT JOIN production_plan pp ON pt.production_plan_id = pp.id
                LEFT JOIN work_order wo ON pp.work_order_id = wo.id
            ${ew.customSqlSegment}
    </select>

</mapper>
