he2802 3 жил өмнө
parent
commit
ec45ce9a03

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/mapper/OrderMapper.java

@@ -25,4 +25,6 @@ public interface OrderMapper extends BaseMapper<Order> {
     Integer getGradePeriod(@Param("orderGoodsId") Long orderGoodsId,@Param("userId") Long userId);
 
     Integer queryByOrderSn(String orderSn);
+
+    List<OrderListVo> selectRebuyList(OrderQueryBo bo);
 }

+ 109 - 0
zhongzheng-system/src/main/resources/mapper/modules/order/OrderMapper.xml

@@ -195,6 +195,115 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ORDER BY o.order_id DESC
     </select>
 
+    <select id="selectRebuyList" parameterType="com.zhongzheng.modules.order.bo.OrderQueryBo" resultMap="OrderResultVo">
+        SELECT
+        o.*,
+        g.goods_id,
+        g.goods_name,
+        g.year,
+        g.cover_url,
+        g.code,
+        g.goods_type,
+        og.goods_price,
+        og.rebuy_order_goods_id,
+        og.order_goods_id,
+        og.goods_real_price,
+        u.telphone,
+        u.realname,
+        u.id_card,
+        cet.education_name,
+        cpt.project_name,
+        cb.business_name,
+        s.school_name,
+        m.category_name,
+        og.goods_received,
+        og.refund_status,
+        og.pay_status as goods_pay_status,
+        (select cgu.period_plush from  class_grade_user cgu where cgu.grade_id = og.grade_id and cgu.user_id = o.user_id limit 1 ) period_plush,
+        (SELECT oi.invoice_status FROM order_invoice oi LEFT JOIN order_invoice_order oio ON oio.invoice_id = oi.invoice_id WHERE
+        oio.order_goods_id = og.order_goods_id AND oi.period_status != 2 limit 1) invoice_status
+        FROM
+        `order` o
+        LEFT JOIN order_goods og ON o.order_sn = og.order_sn
+        LEFT JOIN goods g ON og.goods_id = g.goods_id
+        LEFT JOIN `user` u ON o.user_id = u.user_id
+        LEFT JOIN course_education_type cet ON g.education_type_id = cet.id
+        LEFT JOIN course_project_type cpt ON g.project_id = cpt.id
+        LEFT JOIN course_business cb ON g.business_id = cb.id
+        LEFT JOIN school s ON s.id = g.school_id
+        LEFT JOIN major m ON g.major_id = m.id
+        WHERE 1=1
+
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND g.education_type_id = #{educationTypeId}
+        </if>
+        <if test="businessId != null and businessId != ''">
+            AND g.business_id = #{businessId}
+        </if>
+        <if test="schoolId != null and schoolId != ''">
+            AND g.school_id = #{schoolId}
+        </if>
+        <if test="majorId != null and majorId != ''">
+            AND g.major_id = #{majorId}
+        </if>
+        <if test="orderSn != null and orderSn != ''">
+            AND o.order_sn = #{orderSn}
+        </if>
+        <if test="orderStatus != null ">
+            AND o.order_status in
+            <foreach collection="orderStatus" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="status != null ">
+            AND o.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="startTime != null">
+            AND o.create_time >= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND #{endTime} >= o.create_time
+        </if>
+        <if test="payStatus != null">
+            AND o.pay_status = #{payStatus}
+        </if>
+        <if test="goodsPayStatus != null">
+            AND og.pay_status = #{goodsPayStatus}
+        </if>
+        <if test="refundStatus != null">
+            AND og.refund_status = #{refundStatus}
+        </if>
+        <if test="goodsType != null">
+            AND g.goods_type = #{goodsType}
+        </if>
+        <if test="userId != null">
+            AND u.user_id = #{userId}
+            AND og.pay_status in (2,3,4)
+        </if>
+        <if test="inputOrderSn != null">
+            AND o.input_order_sn = #{inputOrderSn}
+        </if>
+        <if test="searchKey != null and searchKey != ''">
+            AND (u.realname like concat('%', #{searchKey}, '%') or o.order_sn = #{searchKey} or u.id_card = #{searchKey} or g.goods_name like concat('%', #{searchKey}, '%'))
+        </if>
+        <if test="orderGoodsIds != null ">
+            AND og.order_goods_id in
+            <foreach collection="orderGoodsIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="orderFroms != null ">
+            AND o.order_from in
+            <foreach collection="orderFroms" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        ORDER BY o.order_id DESC
+    </select>
+
     <select id="selectUserClass" parameterType="map" resultType="integer">
         SELECT
             COUNT(cg.grade_id)