select id, user_id, pid, top_id, live_rate, dividend_guarantee_rate, audit_status, create_time, update_time from app_user_agent
and user_id = #{userId}
and pid = #{pid}
and top_id = #{topId}
and live_rate = #{liveRate}
and dividend_guarantee_rate = #{dividendGuaranteeRate}
and audit_status = #{auditStatus}
where id = #{id}
insert into app_user_agent
id,
user_id,
pid,
top_id,
live_rate,
dividend_guarantee_rate,
audit_status,
create_time,
update_time,
#{id},
#{userId},
#{pid},
#{topId},
#{liveRate},
#{dividendGuaranteeRate},
#{auditStatus},
#{createTime},
#{updateTime},
update app_user_agent
user_id = #{userId},
pid = #{pid},
top_id = #{topId},
live_rate = #{liveRate},
dividend_guarantee_rate = #{dividendGuaranteeRate},
audit_status = #{auditStatus},
create_time = #{createTime},
update_time = #{updateTime},
where id = #{id}
delete from app_user_agent where id = #{id}
delete from app_user_agent where id in
#{id}
select IFNULL(sum(betting_amount),0) as amount
from app_user_agent as a left join app_game_betting as b on a.user_id = b.user_id
where b.create_time between #{beginTime} and #{endTime}
and a.pid = #{pid}
select
a.user_id as userId,
c.username as nickName,
c.coin as coin,
c.diamond_coin as diamondCoin,
a.pid as pid,
(
select IFNULL(sum(betting_amount),0) from app_game_betting as b where b.user_id = a.user_id
and = concat(#{teamDto.beginTime},' 00:00:00') ]]>
and
) as bettingAmount,
(
select IFNULL(sum(d.game_commission),0) from app_user_count as d where d.user_id = a.user_id
and = #{teamDto.beginTime} ]]>
and
) as gameCommission,
(
select IFNULL(sum(f.live_commission),0) from app_user_count as f where f.user_id = a.user_id
and = #{teamDto.beginTime} ]]>
and
) as liveCommission,
(
select IFNULL(sum(e.game_win_amount - e.game_lose_amount),0) from app_user_count as e where e.user_id = a.user_id
and = #{teamDto.beginTime} ]]>
and
) as gameAmount,
(
select IFNULL(sum(g.recharge_amount),0) from app_user_count as g where g.user_id = a.user_id
and = #{teamDto.beginTime} ]]>
and
) as rechargeAmount,
(
select IFNULL(sum(g.recharge_commission),0) from app_user_count as h where h.user_id = a.user_id
and = #{teamDto.beginTime} ]]>
and
) as rechargeCommission,
(
select IFNULL(sum(g.recharge_give),0) from app_user_count as i where i.user_id = a.user_id
and = #{teamDto.beginTime} ]]>
and
) as rechargeGive,
a.live_rate as liveRate,
a.dividend_guarantee_rate as dividendGuaranteeRate
from app_user_agent as a left join mugozbg_live.app_user as c on a.user_id = c.userid where (a.pid = #{teamDto.pid} or a.user_id = #{teamDto.pid})
and a.user_id = #{teamDto.userId}
and c.username = #{teamDto.nickName}
select
a.user_id as userId,
c.username as nickName,
c.coin as coin,
c.diamond_coin as diamondCoin,
a.pid as pid,
IFNULL(sum(b.game_betting),0) as bettingAmount,
IFNULL(sum(b.game_commission),0) as gameCommission,
IFNULL(sum(b.live_commission),0) as liveCommission,
IFNULL(sum(b.game_win_amount - b.game_lose_amount),0) as gameAmount,
IFNULL(sum(b.recharge_amount),0) as rechargeAmount,
IFNULL(sum(b.recharge_commission),0) as rechargeCommission,
IFNULL(sum(b.recharge_give),0) as rechargeGive,
a.live_rate as liveRate,
a.dividend_guarantee_rate as dividendGuaranteeRate
from app_user_agent as a inner join app_user_count as b on a.user_id = b.user_id left join mugozbg_live.app_user as c on a.user_id = c.userid where (a.pid = #{teamDto.pid} or a.user_id = #{teamDto.pid})
and a.user_id = #{teamDto.userId}
and c.username = #{teamDto.nickName}
and = #{teamDto.beginTime} ]]>
and
group by a.user_id order by a.user_id
WITH RECURSIVE useragent AS
(
SELECT *
FROM app_user_agent
WHERE pid = #{pid}
UNION ALL
SELECT o.*
FROM app_user_agent o
JOIN useragent s ON o.pid = s.user_id
)
SELECT * FROM useragent where 1=1
and user_id = #{userId}