Commit d33fab28 authored by libin's avatar libin

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

parents 6c8dfd64 c057585b
...@@ -7,14 +7,14 @@ ...@@ -7,14 +7,14 @@
SELECT SELECT
aur.user_id, aur.user_id,
aur.bind_time as `leagueTime`, aur.bind_time as `leagueTime`,
ausww.income IFNULL(ausww.income,0) AS `income`
FROM FROM
`app_user_relation` AS `aur` `app_user_relation` AS `aur`
LEFT JOIN (SELECT DISTINCT LEFT JOIN (SELECT DISTINCT
`source_id` AS userId, `source_id` AS userId,
IFNULL( 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 0
) AS `income` ) AS `income`
...@@ -33,44 +33,45 @@ FROM ...@@ -33,44 +33,45 @@ FROM
</select> </select>
<select id="selectSellerWalterByUserIdAndWating" resultType="com.github.wxiaoqi.security.admin.vo.SellingWalletVo"> <select id="selectSellerWalterByUserIdAndWating" resultType="com.github.wxiaoqi.security.admin.vo.SellingWalletVo">
<!-- SELECT <!-- SELECT
* *
FROM FROM
( (
SELECT SELECT
ausw.*, ausw.*,
IFNULL( ausw.commission, 0 ) - IFNULL( auswt.commission, 0 ) AS `commissionnm`, IFNULL( ausw.commission, 0 ) - IFNULL( auswt.commission, 0 ) AS `commissionnm`,
auswt.status AS sellerStatus, auswt.status AS sellerStatus,
IFNULL(auswt.status,0) AS `isShow` IFNULL(auswt.status,0) AS `isShow`
FROM FROM
( SELECT * FROM `app_user_selling_water` WHERE STATUS = 0 AND `user_id`=#{userId} <if test="wating!=null"> ( 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; AND `waiting`=#{wating} &lt;!&ndash;AND `status`=0&ndash;&gt;
</if>) AS `ausw` </if>) AS `ausw`
LEFT JOIN ( SELECT * FROM `app_user_selling_water` WHERE STATUS = 1 AND `user_id`=#{userId} <if LEFT JOIN ( SELECT * FROM `app_user_selling_water` WHERE STATUS = 1 AND `user_id`=#{userId} <if
test="wating!=null"> test="wating!=null">
AND `waiting`=#{wating} &lt;!&ndash;AND `status`=0&ndash;&gt; AND `waiting`=#{wating} &lt;!&ndash;AND `status`=0&ndash;&gt;
</if>) AS `auswt` ON auswt.order_no = ausw.order_no </if>) AS `auswt` ON auswt.order_no = ausw.order_no
) AS `auswres` ) AS `auswres`
ORDER BY crt_time DESC--> ORDER BY crt_time DESC-->
SELECT w.*,o.commission as commission ,o.type AS `sellerStatus` FROM ( 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 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} SELECT order_no,commission as z,0 as f FROM app_user_selling_water WHERE user_id=#{userId}
AND `status`=0 and commission>0 AND `status`=0 and commission>0
UNION UNION
SELECT order_no,0 as z,commission as f FROM app_user_selling_water WHERE user_id=#{userId} SELECT order_no,0 as z,commission as f FROM app_user_selling_water WHERE user_id=#{userId}
AND `status`=1 and commission>0 AND `status`=1 and commission>0
) as t ) as t
GROUP BY t.order_no 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 ON o.order_no=w.order_no
where 1=1 where 1=1
<if test="wating!=null"> <if test="wating!=null">
and `waiting`= #{wating} and <![CDATA[ and `waiting`= #{wating} and <![CDATA[
o.`type`<>1 ]]> o.`type`<>1 ]]>
</if> </if>
ORDER BY `crt_time` ORDER BY `crt_time`
</select> </select>
</mapper> </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