|
@@ -47,7 +47,7 @@
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findReceiptList" resultType="com.caimei.modules.order.entity.ReceiptVo">
|
|
<select id="findReceiptList" resultType="com.caimei.modules.order.entity.ReceiptVo">
|
|
- SELECT
|
|
|
|
|
|
+ (SELECT
|
|
a.id AS "receiptId",
|
|
a.id AS "receiptId",
|
|
a.payWay AS "payWay",
|
|
a.payWay AS "payWay",
|
|
a.payType AS "payType",
|
|
a.payType AS "payType",
|
|
@@ -64,11 +64,83 @@
|
|
c.name as clubName
|
|
c.name as clubName
|
|
FROM cm_discern_receipt a
|
|
FROM cm_discern_receipt a
|
|
left join cm_receipt_order_relation crr on crr.receiptId = a.id and crr.delFlag = '0'
|
|
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 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 > #{startTime} OR a.receiptDate = #{startTime})
|
|
|
|
+ </if>
|
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
|
+ AND (a.receiptDate < #{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
|
|
LEFT JOIN cm_offline_collection cof ON a.payType = cof.type
|
|
<where>
|
|
<where>
|
|
|
|
+ crr.relationType != 1
|
|
<if test="organizeId != null">
|
|
<if test="organizeId != null">
|
|
AND cr.organizeId = #{organizeId}
|
|
AND cr.organizeId = #{organizeId}
|
|
</if>
|
|
</if>
|
|
@@ -114,7 +186,7 @@
|
|
and a.delFlag = 0
|
|
and a.delFlag = 0
|
|
</where>
|
|
</where>
|
|
group by a.id
|
|
group by a.id
|
|
- order by a.id desc
|
|
|
|
|
|
+ order by a.id desc)
|
|
</select>
|
|
</select>
|
|
|
|
|
|
<select id="findReceiptDetail" resultType="com.caimei.modules.order.entity.ReceiptDetail">
|
|
<select id="findReceiptDetail" resultType="com.caimei.modules.order.entity.ReceiptDetail">
|