From 4d1a30da0ec4d37694baeb129a9a21aa29c157b7 Mon Sep 17 00:00:00 2001 From: Fancy <Fancy.fx@outlook.com> Date: 星期四, 22 八月 2024 10:19:15 +0800 Subject: [PATCH] fix order complete Rate --- pms-parent/pms-global/src/main/resources/mapper/PrOrderItemMapper.xml | 16 +++++++++------- 1 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrOrderItemMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrOrderItemMapper.xml index 7d632da..972b95e 100644 --- a/pms-parent/pms-global/src/main/resources/mapper/PrOrderItemMapper.xml +++ b/pms-parent/pms-global/src/main/resources/mapper/PrOrderItemMapper.xml @@ -25,11 +25,13 @@ where id = #{id,jdbcType=BIGINT} </select> <select id="selectItems" parameterType="java.lang.Long" resultMap="BaseResultMap"> - <!--绠楀嚭瀹屾垚鐜�--> - select - <include refid="Base_Column_List" /> - from pr_order_item - where order_id = #{orderId,jdbcType=BIGINT} and deleted !=1 + <!--绠楀嚭瀹屾垚鐜� Base_Column_List--> + SELECT aa.*, concat(round(((complete_number/number) * 100 ),2), '%') as complete_rate from ( + select oi.id,oi.order_id,oi.pro_id,oi.number, sum(IFNULL(pap.output_number,0)) as complete_number + from (SELECT * from pr_order_item where order_id = #{orderId,jdbcType=BIGINT} and deleted !=1 ) oi + LEFT JOIN pr_assembly_plan pap + ON oi.order_id = pap.order_id AND oi.pro_id = pap.pro_id + GROUP BY oi.id,oi.order_id,oi.pro_id,oi.number) aa </select> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> delete from pr_order_item @@ -95,7 +97,7 @@ where p.deleted!=1 <trim prefix="and " suffixOverrides="and"> <if test="orderId != null and orderId != ''"> - p.orderId = #{orderId,jdbcType=BIGINT} and + p.order_id = #{orderId,jdbcType=BIGINT} and </if> </trim> order by id desc @@ -112,7 +114,7 @@ where p.deleted!=1 <trim prefix="and " suffixOverrides="and"> <if test="orderId != null and orderId != ''"> - p.orderId = #{orderId,jdbcType=BIGINT} and + p.order_id = #{orderId,jdbcType=BIGINT} and </if> </trim> </select> -- Gitblit v1.8.0