<?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.ProductionProcessesMapper">
    <select id="getPage" resultType="com.fjhx.mes.entity.production.vo.ProductionProcessesVo">
        select pp.id,
               pp.name,
               pp.remarks,
               pp.file_name,
               pp.code,
               pp.cost_price,
               pp.capacity,
               pp.create_user,
               pp.create_time,
               pp.update_user,
               pp.update_time
        from production_processes pp
            ${ew.customSqlSegment}
    </select>

    <update id="updateFileName">
        update production_processes
        set file_name = #{fileName}
        where id = #{id}
    </update>

    <select id="getProcessesByProductId" resultType="com.fjhx.mes.entity.production.vo.ProductionProcessesVo">
        SELECT pp.id,
               pp.`name`,
               pi.id as productId
        FROM production_processes pp
                 JOIN technology_process_line tpl ON tpl.source_processes_id = pp.id
                 JOIN product_info pi ON pi.technology_id = tpl.technology_id
            ${ew.customSqlSegment}
    </select>

</mapper>
