|
@@ -60,16 +60,22 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="findList" resultType="CmDiscernReceipt">
|
|
|
+ -- relationType值为1是为子订单ID,为2时为主订单ID)
|
|
|
SELECT
|
|
|
- <include refid="cmDiscernReceiptColumns"/>
|
|
|
- ,IF(a.receiptType='3',u_cr.userName,u.userName) AS "userName",IF(a.receiptType='3',u_cr.name,u.name) AS "name",
|
|
|
+ <include refid="cmDiscernReceiptColumns"/>,
|
|
|
+ (case when crr.relationType = '1' then u_cr.userName else u.userName
|
|
|
+ end) AS "userName",
|
|
|
+ (case when crr.relationType = '1' then u_cr.name else u.name
|
|
|
+ end) AS "name",
|
|
|
cr.organizeID AS organizeID
|
|
|
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 user u on u.userID = cr.userID
|
|
|
+ -- 子订单
|
|
|
left join cm_shop_order cso on cso.shopOrderID = crr.orderID
|
|
|
left join cm_order cso_cr on cso.orderID = cso_cr.orderID
|
|
|
- left join user u on u.userID = cr.userID
|
|
|
LEFT JOIN USER u_cr ON u_cr.userID = cso_cr.userID
|
|
|
<where>
|
|
|
<if test="id != null and id != '' and id != 0 ">
|