From 5e75ef24e5dd45ae934dc7f03f6c7736ca73c9ff Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期二, 27 八月 2024 15:01:32 +0800
Subject: [PATCH] fix order search
---
pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrOrderItem.java | 2 +-
pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java | 2 +-
pms-parent/pms-global/src/main/resources/mapper/PrOrderMapper.xml | 6 +++++-
pms-parent/pms-global/src/main/resources/mapper/PrOrderItemMapper.xml | 12 +++++++++++-
4 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrOrderItem.java b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrOrderItem.java
index 8592795..ac53bae 100644
--- a/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrOrderItem.java
+++ b/pms-parent/pms-global/src/main/java/com/dy/pmsGlobal/pojoPr/PrOrderItem.java
@@ -38,7 +38,7 @@
public Long proId;
@TableField(exist = false)
- public String proName;
+ public String name;
/**
* 鐢熶骇鏁伴噺
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 f928401..51b0196 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrOrderItemMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrOrderItemMapper.xml
@@ -11,7 +11,7 @@
<result property="number" column="number" jdbcType="INTEGER"/>
<result property="completeNumber" column="complete_number" jdbcType="INTEGER"/>
<result column="deleted" property="deleted" typeHandler="com.dy.common.mybatis.BooleanTypeHandler" />
- <result property="proName" column="pro_id" jdbcType="VARCHAR"/>
+ <result property="name" column="pro_id" jdbcType="VARCHAR"/>
<!-- <association property="proName" column="pro_id" javaType="java.lang.Long"
select="com.dy.pmsGlobal.daoPlt.PltProductMapper.selectProNameById" fetchType="eager"/>-->
</resultMap>
@@ -38,6 +38,16 @@
ON oi.pro_id = pp.id
GROUP BY oi.id,oi.order_id,oi.pro_id,oi.number) aa
</select>
+ <select id="selectDistinctPro" parameterType="java.lang.Long" resultMap="BaseResultMap">
+ <!--Distinct鍑簅rder_id涓殑浜у搧 Base_Column_List-->
+ select DISTINCT(oi.order_id),oi.pro_id,pp.`name`
+ from (SELECT * from pr_order_item where order_id = #{orderId,jdbcType=BIGINT} and deleted !=1 ) oi
+ LEFT JOIN plt_product pp
+ ON oi.pro_id = pp.id
+ GROUP BY oi.order_id,oi.pro_id
+ ORDER BY oi.order_id
+ </select>
+
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from pr_order_item
where id = #{id,jdbcType=BIGINT}
diff --git a/pms-parent/pms-global/src/main/resources/mapper/PrOrderMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/PrOrderMapper.xml
index c52c967..29162fd 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/PrOrderMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/PrOrderMapper.xml
@@ -21,6 +21,9 @@
<resultMap id="BaseResultMap2" type="com.dy.pmsGlobal.pojoPr.PrOrder" extends="BaseResultMap">
<collection property="items" ofType="com.dy.pmsGlobal.pojoPr.PrOrderItem" fetchType="eager" select="com.dy.pmsGlobal.daoPr.PrOrderItemMapper.selectItems" column="id" />
</resultMap>
+ <resultMap id="BaseResultMap3" type="com.dy.pmsGlobal.pojoPr.PrOrder" extends="BaseResultMap">
+ <collection property="items" ofType="com.dy.pmsGlobal.pojoPr.PrOrderItem" fetchType="eager" select="com.dy.pmsGlobal.daoPr.PrOrderItemMapper.selectDistinctPro" column="id" />
+ </resultMap>
<sql id="Base_Column_List">
id,`name`,customer_name,project_name,
director,d_mobile,delivery_date,
@@ -107,7 +110,8 @@
</if>
</trim>
</select>
- <select id="selectAll" resultMap="BaseResultMap2">
+ <!--涓嬫媺鑿滃崟 瀹炵幇璁㈠崟 浜у搧鑱斿姩鏁堟灉-->
+ <select id="selectAll" resultMap="BaseResultMap3">
select
<include refid="Base_Column_List" />
from pr_order p
diff --git a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java
index f0ac85d..4c909c6 100644
--- a/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java
+++ b/pms-parent/pms-web-product/src/main/java/com/dy/pmsProduct/order/OrderSv.java
@@ -124,7 +124,7 @@
}
private void changeRate(PrOrder prOrder) {
- if (prOrder.items != null) {
+ if (prOrder != null && prOrder.items != null) {
List<PrOrderItem> items = prOrder.items;
for (int i = 1; i < items.size(); i++) {
for (int j = i - 1; j >= 0; j--) {
--
Gitblit v1.8.0