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

</mapper>
