From 5ffa5d2c1cf6015815a77ed1042313aca1d9fc37 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 22 Jul 2021 11:56:12 +0800
Subject: [PATCH] fix
---
gc-user/src/main/resources/mapper/user/OrderMapper.xml | 268 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 239 insertions(+), 29 deletions(-)
diff --git a/gc-user/src/main/resources/mapper/user/OrderMapper.xml b/gc-user/src/main/resources/mapper/user/OrderMapper.xml
index f61e067..b141ed5 100644
--- a/gc-user/src/main/resources/mapper/user/OrderMapper.xml
+++ b/gc-user/src/main/resources/mapper/user/OrderMapper.xml
@@ -110,25 +110,135 @@
WHERE a.create_user_id = #{userId} and a.order_status in (4, 5, 7)
</select>
- <select id="queryUserOrderList" resultType="java.util.Map">
- select a.create_time as createTime,a.order_id as orderId,sum(b.money) as money,sum(b.weight) as weight from
- xzx_order_info a
- LEFT JOIN xzx_order_item_info b ON a.order_id = b.order_id
- where a.create_user_id=#{userId}
- and a.order_status in ('4','5','7')
- and a.del_flag=0 and a.cancel_user_id is null
- GROUP BY a.order_id order by a.create_time
- </select>
+<!-- <select id="queryUserOrderList" resultType="java.util.Map">-->
+<!-- select a.create_time as createTime,a.order_id as orderId,sum(b.money) as money,sum(b.weight) as weight from-->
+<!-- xzx_order_info a-->
+<!-- LEFT JOIN xzx_order_item_info b ON a.order_id = b.order_id-->
+<!-- where a.create_user_id=#{userId}-->
+<!-- and a.order_status in ('4','5','7')-->
+<!-- and a.del_flag=0 and a.cancel_user_id is null-->
+<!-- GROUP BY a.order_id order by a.create_time-->
+<!-- </select>-->
+ <select id="queryUserOrderList" resultType="java.util.HashMap">
+ SELECT
+ orderId,
+ address,
+ status,
+ type,
+ money,
+ score,
+ weight,
+ name,
+ createTime
+ FROM
+ (
+ (
+ SELECT
+ a.order_id orderId,
+ a.order_status STATUS,
+ '1' type,
+ ifnull(sum(d.money), 0) money,
+ '0' score,
+ a.address address,
+ ifnull(sum(d.weight), 0) weight,
+ e. NAME NAME,
+ a.create_time createTime
+ FROM
+ xzx_order_info a
+ LEFT JOIN xzx_order_item_info d ON a.order_id = d.order_id
+ LEFT JOIN xzx_user_info e ON e.user_id = a.receiver
+ WHERE
+ a.create_user_id = #{userId}
+ GROUP BY
+ a.order_id
+ )
+ UNION
+ (
+ SELECT
+ a.id orderId,
+ a. STATUS STATUS,
+ '2' type,
+ '0' money,
+ ifnull(sum(d.score), 0) score,
+ a.address address,
+ ifnull(sum(d.weight), 0) weight,
+ a.username NAME,
+ a.CREATED_TIME createTime
+ FROM
+ xzx_jhy_order a
+ LEFT JOIN xzx_jhy_order_items d ON a.id = d.order_id
+ WHERE
+ a.user_id = #{userId}
+ GROUP BY
+ a.id
+ )
+ ) v
+ ORDER BY
+ createTime DESC
+
+ </select>
+
+<!-- <select id="queryCuserOrderCount" resultType="java.util.HashMap">-->
+<!-- SELECT COUNT(*) as count FROM xzx_order_info WHERE create_user_id=#{userId}-->
+<!-- <if test="status != null">-->
+<!-- and order_status in-->
+<!-- <foreach collection="status" index="index" item="id" open="(" separator="," close=")">-->
+<!-- #{id}-->
+<!-- </foreach>-->
+<!-- </if>-->
+<!-- GROUP BY order_type-->
+<!-- </select>-->
<select id="queryCuserOrderCount" resultType="java.util.HashMap">
- SELECT COUNT(*) as count FROM xzx_order_info WHERE create_user_id=#{userId}
- <if test="status != null">
- and order_status in
- <foreach collection="status" index="index" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- GROUP BY order_type
+ SELECT
+ COUNT(*) as count
+ FROM
+ (
+ (
+ SELECT
+ a.order_id orderId,
+ a.order_status STATUS,
+ '1' type,
+ ifnull(sum(d.money), 0) money,
+ '0' score,
+ a.address address,
+ ifnull(sum(d.weight), 0) weight,
+ e. NAME NAME,
+ a.create_time createTime
+ FROM
+ xzx_order_info a
+ LEFT JOIN xzx_order_item_info d ON a.order_id = d.order_id
+ LEFT JOIN xzx_user_info e ON e.user_id = a.receiver
+ WHERE
+ a.create_user_id=#{userId}
+ and a.order_status in (4,5,7)
+ GROUP BY
+ a.order_id
+ )
+ UNION
+ (
+ SELECT
+ a.id orderId,
+ a. STATUS STATUS,
+ '2' type,
+ '0' money,
+ ifnull(sum(d.score), 0) score,
+ a.address address,
+ ifnull(sum(d.weight), 0) weight,
+ a.username NAME,
+ a.CREATED_TIME createTime
+ FROM
+ xzx_jhy_order a
+ LEFT JOIN xzx_jhy_order_items d ON a.id = d.order_id
+ WHERE
+ a.user_id = #{userId}
+ and a.status = 3
+ GROUP BY
+ a.id
+ )
+ ) v
+ ORDER BY
+ createTime DESC
</select>
<select id="queryPromoterOrderWeightMoney" resultType="com.xzx.gc.model.admin.PromoterModel">
@@ -257,19 +367,80 @@
</if>
</select>
- <select id="queryCuserOrderFinishList" resultType="java.util.HashMap">
- SELECT a.order_id as orderId, sum(d.money) as money,sum(d.weight) as weight,a.create_time as createTime FROM
- xzx_order_info a
- LEFT JOIN xzx_order_item_info d on a.order_id = d.order_id
- WHERE a.create_user_id=#{userId}
- <if test="status != null">
- and a.order_status in
- <foreach collection="status" index="index" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
+<!-- <select id="queryCuserOrderFinishList" resultType="java.util.HashMap">-->
+<!-- SELECT a.order_id as orderId, sum(d.money) as money,sum(d.weight) as weight,a.create_time as createTime FROM-->
+<!-- xzx_order_info a-->
+<!-- LEFT JOIN xzx_order_item_info d on a.order_id = d.order_id-->
+<!-- WHERE a.create_user_id=#{userId}-->
+<!-- <if test="status != null">-->
+<!-- and a.order_status in-->
+<!-- <foreach collection="status" index="index" item="id" open="(" separator="," close=")">-->
+<!-- #{id}-->
+<!-- </foreach>-->
+<!-- </if>-->
- GROUP BY a.order_id
+<!-- GROUP BY a.order_id-->
+<!-- </select>-->
+ <select id="queryCuserOrderFinishList" resultType="java.util.HashMap">
+ SELECT
+ orderId,
+ address,
+ status,
+ type,
+ money,
+ score,
+ weight,
+ name,
+ createTime
+ FROM
+ (
+ (
+ SELECT
+ a.order_id orderId,
+ a.order_status STATUS,
+ '1' type,
+ ifnull(sum(d.money), 0) money,
+ '0' score,
+ CONCAT(a.address_area, a.address) address,
+ ifnull(sum(d.weight), 0) weight,
+ e.NAME name,
+ a.create_time createTime
+ FROM
+ xzx_order_info a
+ LEFT JOIN xzx_order_item_info d ON a.order_id = d.order_id
+ LEFT JOIN xzx_user_info e ON e.user_id = a.receiver
+ WHERE
+ a.create_user_id = #{userId}
+ and a.order_status in (4,5,7)
+ GROUP BY
+ a.order_id
+ )
+ UNION
+ (
+ SELECT
+ a.order_no orderId,
+ a. STATUS STATUS,
+ '2' type,
+ '0' money,
+ ifnull(sum(d.score), 0) score,
+ CONCAT(a.area, a.address) address,
+ ifnull(sum(d.weight), 0) weight,
+ e.username name,
+ a.CREATED_TIME createTime
+ FROM
+ xzx_jhy_order a
+ LEFT JOIN xzx_jhy_order_items d ON a.id = d.order_id
+ LEFT JOIN xzx_jhy_info e ON a.jhy_id = e.user_id
+ WHERE
+ a.user_id = #{userId}
+ and a.status = 3
+ GROUP BY
+ a.id
+ )
+ ) v
+ ORDER BY
+ createTime DESC
+
</select>
@@ -399,4 +570,43 @@
b.receive_time ASC
</select>
+ <select id="selectJhyOrderByUserId" resultType="com.xzx.gc.entity.JhyOrder">
+ SELECT
+ a.*
+ FROM
+ xzx_jhy_order a
+ WHERE
+ a.status != '5'
+ and a.user_id = #{userId}
+ </select>
+
+ <select id="selectOrderByUserId" resultType="com.xzx.gc.entity.OrderInfo">
+ SELECT
+ a.*
+ FROM
+ xzx_order_info a
+ WHERE
+ a.order_status != '6'
+ and a.create_user_id = #{userId}
+ </select>
+
+ <select id="selectListByOrderId" resultType="com.xzx.gc.user.vo.CategaryVo">
+ SELECT
+ b.title
+ FROM
+ xzx_order_item_info a
+ LEFT JOIN xzx_sys_environmental_info b ON a.item_type = b.item_type
+ where a.order_id = #{orderId}
+ and a.weight >0
+ GROUP BY a.item_type
+ </select>
+
+ <select id="selectJHYListByOrderId" resultType="com.xzx.gc.user.vo.CategaryVo">
+
+ SELECT
+ a.title title
+ FROM
+ xzx_jhy_order_items a
+ WHERE a.order_id = (select b.id from xzx_jhy_order b where b.order_no = #{orderId})
+ </select>
</mapper>
--
Gitblit v1.9.1