chenhj
2026-04-22 2ab6b6860e4f7bee67a0f66831b9b1fb0f420710
src/main/resources/mapper/production/ProductionProductOutputMapper.xml
@@ -15,4 +15,47 @@
        <result column="update_user" property="updateUser" />
    </resultMap>
    <select id="listPageProductionProductOutputDto" resultType="com.ruoyi.production.bean.dto.ProductionProductOutputDto">
        select ppo.*,
               ppm.product_no as productNo,
               pm.model
        from production_product_output ppo
                 left join production_product_main ppm on ppo.production_product_main_id = ppm.id
                 left join production_operation_task pot on ppm.production_operation_task_id = pot.id
                 left join production_order po on pot.production_order_id = po.id
                 left join product_model pm on po.product_model_id = pm.id
        <where>
            <if test="c.productNo != null and c.productNo != ''">
                and ppm.product_no like concat('%', #{c.productNo}, '%')
            </if>
            <if test="c.model != null and c.model != ''">
                and pm.model like concat('%', #{c.model}, '%')
            </if>
        </where>
        order by ppo.create_time desc
    </select>
    <select id="selectOutputStats" resultType="com.ruoyi.production.bean.dto.ProductionProductOutputDto">
        select id,
               production_product_main_id as productionProductMainId,
               product_model_id as productModelId,
               quantity,
               scrap_qty as scrapQty,
               create_time as createTime
        from production_product_output
        where create_time &gt;= #{startDate}
          and create_time &lt;= #{endDate}
    </select>
    <select id="selectDailyOutputStats" resultType="java.util.Map">
        select date(create_time) as statDate,
               sum(ifnull(quantity, 0)) as quantity,
               sum(ifnull(scrap_qty, 0)) as scrapQty
        from production_product_output
        where create_time &gt;= #{startDate}
          and create_time &lt;= #{endDate}
        group by date(create_time)
        order by statDate asc
    </select>
</mapper>