<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.xcong.excoin.modules.otc.dao.OtcReturnMoneyDao">
|
|
<select id="selectMyTeamAmountInPage" resultType="com.xcong.excoin.modules.otc.vo.TeamVo">
|
select
|
substring(invite_id, -4) inviteId,
|
case when a.referer_id = #{inviteId} then 1
|
else 2 end level,
|
sum(IFNULL(b.amount, 0)) amount
|
from member a
|
left join otc_return_money b on b.from_member_id=a.id and b.to_member_id=#{memberId}
|
where find_in_set(#{inviteId}, SUBSTRING_INDEX(referer_ids, ',', 3))
|
group by a.id
|
order by amount desc
|
</select>
|
|
<select id="selectTotalAmount" resultType="java.math.BigDecimal">
|
select IFNULL(sum(amount), 0)
|
from otc_return_money
|
where to_member_id=#{memberId}
|
</select>
|
</mapper>
|