廖井涛
2025-08-25 fec9f42e00f2df68a2a20cbf132b17bdeed8e63a
north-glass-erp/src/main/resources/mapper/pp/DamageDetails.xml
@@ -9,12 +9,36 @@
    left join pp.reporting_work as b
    on a.reporting_work_id = b.reporting_work_id
    WHERE a.process_id = #{processId}
    <if test="needOrderNumber!=null">
    and a.order_number = #{orderNumber}
    </if>
    and a.technology_number =#{technologyNumber}
    and a.breakage_quantity>0
    and a.patch_status=0
    and b.reviewed_state>=0
    and b.this_process in (SUBSTRING_INDEX(#{behindProcess},',',1))
</select>
    and b.this_process in (WITH RECURSIVE cte AS (
                            SELECT 1 AS n
                            UNION ALL
                            SELECT n + 1 FROM cte WHERE n &lt; 20 -- 这里的 20 是最大拆分个数
                        )
                           SELECT REGEXP_SUBSTR(#{behindProcess}, '[^,]+', 1, n) AS process
                           FROM cte
                           WHERE REGEXP_SUBSTR(#{behindProcess}, '[^,]+', 1, n) IS NOT NULL)
</select>
    <select id="getNotReview">
    select a.*
    from damage_details as a
    left join reporting_work as b
    on a.reporting_work_id = b.reporting_work_id
    where a.process_id=#{processId}
     and b.reviewed_state>=0
  <if test="orderNumber!= null">
      and a.order_number = #{orderNumber}
  </if>
    and a.technology_number = #{technologyNumber}
     and     a.patch_status=0
    and a.breakage_quantity>0
    </select>
</mapper>