Преглед изворни кода

Merge remote-tracking branch 'origin/developer' into developerB

# Conflicts:
#	src/main/resources/mapper/CmDiscernReceiptMapper.xml
huangzhiguo пре 2 година
родитељ
комит
6c031703ab
1 измењених фајлова са 77 додато и 6 уклоњено
  1. 77 6
      src/main/resources/mapper/CmDiscernReceiptMapper.xml

+ 77 - 6
src/main/resources/mapper/CmDiscernReceiptMapper.xml

@@ -47,7 +47,7 @@
     </select>
 
     <select id="findReceiptList" resultType="com.caimei.modules.order.entity.ReceiptVo">
-        SELECT
+        (SELECT
         a.id AS "receiptId",
         a.payWay AS "payWay",
         a.payType AS "payType",
@@ -69,12 +69,83 @@
         c.name as clubName
         FROM cm_discern_receipt a
         left join cm_receipt_order_relation crr on crr.receiptId = a.id and crr.delFlag = '0'
-        left join cm_order cr on cr.orderId = crr.orderId
-        left join serviceprovider sp ON cr.spID = sp.serviceProviderID
-        left join club c on cr.userId = c.userId
-        left join cm_shop_order cso on cso.orderId = crr.orderId
+        LEFT JOIN cm_shop_order cso ON cso.shopOrderId = crr.orderId
+        LEFT JOIN cm_order cr ON cr.orderId = cso.orderId
+        LEFT JOIN club c ON cr.userId = c.userId
+        LEFT JOIN cm_offline_collection cof ON a.payType = cof.type
+        <where>
+            crr.relationType = 1
+            <if test="organizeId != null">
+                AND cr.organizeId = #{organizeId}
+            </if>
+            <if test="receiptId != null">
+                AND a.id = #{receiptId}
+            </if>
+            <if test="startTime != null and startTime != ''">
+                AND (a.receiptDate &gt; #{startTime} OR a.receiptDate = #{startTime})
+            </if>
+            <if test="endTime != null and endTime != ''">
+                AND (a.receiptDate &lt; #{endTime} OR a.receiptDate = #{endTime})
+            </if>
+            <if test="payWay != null and payWay != ''">
+                AND a.payWay = #{payWay}
+            </if>
+            <if test="payType != null and payType != ''">
+                AND a.payType = #{payType}
+            </if>
+            <if test="receiptStatus != null and receiptStatus != ''">
+                AND a.receiptStatus = #{receiptStatus}
+            </if>
+            <if test="orderNo != null and orderNo != ''">
+                AND ((cr.orderNo like concat('%',#{orderNo},'%')) OR (cso.shopOrderNo like concat('%',#{orderNo},'%')))
+            </if>
+            <if test="orderId != null and orderId != ''">
+                AND cr.orderId = #{orderId}
+            </if>
+            <if test="clubName != null and clubName != ''">
+                AND (c.name LIKE concat('%',#{clubName},'%'))
+            </if>
+            <if test="receiptProgress != null">
+                AND cr.receiptStatus = #{receiptProgress}
+            </if>
+            <if test="associationNum != null and associationNum != ''">
+                <if test="associationNum == 1">
+                    and (select count(1) from cm_receipt_order_relation where receiptId = a.id and delFlag = '0') = 1
+                </if>
+                <if test="associationNum == 2">
+                    and (select count(1) from cm_receipt_order_relation where receiptId = a.id and delFlag = '0')
+                    <![CDATA[ > ]]> 1
+                </if>
+            </if>
+            and a.delFlag = 0
+        </where>
+        group by a.id
+        order by a.id desc)
+        union
+        (
+        SELECT
+        a.id AS "receiptId",
+        a.payWay AS "payWay",
+        a.payType AS "payType",
+        a.receiptStatus AS "receiptStatus",
+        a.receiptAmount AS "receiptAmount",
+        a.receiptDate AS "receiptTime",
+        a.newReceiptType,
+        cso.orderId AS orderId,
+        cso.shopOrderNo as shopOrderNos,
+        cso.shopOrderId as shopOrderId,
+        cof.bankAccount AS bankNameType,
+        cr.organizeId AS organizeId,
+        cr.orderNo,
+        c.name as clubName
+        FROM cm_discern_receipt a
+        LEFT JOIN cm_receipt_order_relation crr ON crr.receiptId = a.id AND crr.delFlag = '0'
+        LEFT JOIN cm_order cr ON cr.orderId = crr.orderId
+        LEFT JOIN cm_shop_order cso ON cso.orderId = cr.orderId
+        LEFT JOIN club c ON cr.userId = c.userId
         LEFT JOIN cm_offline_collection cof ON a.payType = cof.type
         <where>
+            crr.relationType != 1
             <if test="organizeId != null">
                 AND cr.organizeId = #{organizeId}
             </if>
@@ -123,7 +194,7 @@
             and a.delFlag = 0
         </where>
         group by a.id
-        order by a.id desc
+        order by a.id desc)
     </select>
 
     <select id="findReceiptDetail" resultType="com.caimei.modules.order.entity.ReceiptDetail">