Commit d33fab28 authored by libin's avatar libin

Merge branch 'master-wallet-bug-fix' into dev

parents 6c8dfd64 c057585b
......@@ -7,14 +7,14 @@
SELECT
aur.user_id,
aur.bind_time as `leagueTime`,
ausww.income
IFNULL(ausww.income,0) AS `income`
FROM
`app_user_relation` AS `aur`
LEFT JOIN (SELECT DISTINCT
`source_id` AS userId,
IFNULL(
(
( SELECT SUM( commission ) FROM `app_user_selling_water` WHERE source_id = ausw.source_id AND `status` = 0 ) - ( SELECT SUM( commission ) FROM `app_user_selling_water` WHERE source_id = ausw.source_id AND `status` = 1 )
( SELECT IFNULL(SUM( commission ),0) FROM `app_user_selling_water` WHERE source_id = ausw.source_id AND `status` = 0 ) - ( SELECT IFNULL(SUM( commission ),0) FROM `app_user_selling_water` WHERE source_id = ausw.source_id AND `status` = 1 )
),
0
) AS `income`
......@@ -33,44 +33,45 @@ FROM
</select>
<select id="selectSellerWalterByUserIdAndWating" resultType="com.github.wxiaoqi.security.admin.vo.SellingWalletVo">
<!-- SELECT
*
FROM
(
SELECT
ausw.*,
IFNULL( ausw.commission, 0 ) - IFNULL( auswt.commission, 0 ) AS `commissionnm`,
auswt.status AS sellerStatus,
IFNULL(auswt.status,0) AS `isShow`
FROM
( SELECT * FROM `app_user_selling_water` WHERE STATUS = 0 AND `user_id`=#{userId} <if test="wating!=null">
AND `waiting`=#{wating} &lt;!&ndash;AND `status`=0&ndash;&gt;
</if>) AS `ausw`
LEFT JOIN ( SELECT * FROM `app_user_selling_water` WHERE STATUS = 1 AND `user_id`=#{userId} <if
test="wating!=null">
AND `waiting`=#{wating} &lt;!&ndash;AND `status`=0&ndash;&gt;
</if>) AS `auswt` ON auswt.order_no = ausw.order_no
) AS `auswres`
ORDER BY crt_time DESC-->
<!-- SELECT
*
FROM
(
SELECT
ausw.*,
IFNULL( ausw.commission, 0 ) - IFNULL( auswt.commission, 0 ) AS `commissionnm`,
auswt.status AS sellerStatus,
IFNULL(auswt.status,0) AS `isShow`
FROM
( SELECT * FROM `app_user_selling_water` WHERE STATUS = 0 AND `user_id`=#{userId} <if test="wating!=null">
AND `waiting`=#{wating} &lt;!&ndash;AND `status`=0&ndash;&gt;
</if>) AS `ausw`
LEFT JOIN ( SELECT * FROM `app_user_selling_water` WHERE STATUS = 1 AND `user_id`=#{userId} <if
test="wating!=null">
AND `waiting`=#{wating} &lt;!&ndash;AND `status`=0&ndash;&gt;
</if>) AS `auswt` ON auswt.order_no = ausw.order_no
) AS `auswres`
ORDER BY crt_time DESC-->
SELECT w.*,o.commission as commission ,o.type AS `sellerStatus` FROM (
SELECT t.order_no,SUM(t.z)-SUM(t.f) as commission,IF(SUM(t.f)>0,'1',0)as type FROM (
SELECT order_no,commission as z,0 as f FROM app_user_selling_water WHERE user_id=#{userId}
AND `status`=0 and commission>0
SELECT order_no,commission as z,0 as f FROM app_user_selling_water WHERE user_id=#{userId}
AND `status`=0 and commission>0
UNION
SELECT order_no,0 as z,commission as f FROM app_user_selling_water WHERE user_id=#{userId}
AND `status`=1 and commission>0
SELECT order_no,0 as z,commission as f FROM app_user_selling_water WHERE user_id=#{userId}
AND `status`=1 and commission>0
) as t
GROUP BY t.order_no
) o LEFT JOIN ( SELECT DISTINCT order_no,user_id,source_id,order_type,img,price,title,waiting,`crt_time` FROM app_user_selling_water ) w
) o LEFT JOIN ( SELECT DISTINCT order_no,user_id,source_id,order_type,img,price,title,waiting,`crt_time` FROM
app_user_selling_water ) w
ON o.order_no=w.order_no
where 1=1
<if test="wating!=null">
and `waiting`= #{wating} and <![CDATA[
<if test="wating!=null">
and `waiting`= #{wating} and <![CDATA[
o.`type`<>1 ]]>
</if>
</if>
ORDER BY `crt_time`
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment