sql修改
This commit is contained in:
parent
ca93eb959e
commit
3984027965
|
|
@ -298,10 +298,15 @@
|
||||||
|
|
||||||
|
|
||||||
<select id="selectInviteUserList" resultType="com.sqx.modules.app.entity.UserEntity">
|
<select id="selectInviteUserList" resultType="com.sqx.modules.app.entity.UserEntity">
|
||||||
select *,(select count(*) from tb_user u1 where u1.inviter_code=u.invitation_code) as counts,
|
SELECT
|
||||||
(select ifnull(sum(money),0.00) from invite i where i.user_id=u.user_id) as money
|
u.*,
|
||||||
from tb_user u
|
IFNULL( b.counts, 0 ) AS counts,
|
||||||
where 1=1
|
0 AS money
|
||||||
|
FROM
|
||||||
|
tb_user u
|
||||||
|
LEFT JOIN ( SELECT inviter_code, COUNT(*) AS counts FROM tb_user u1 GROUP BY inviter_code ) AS b ON u.invitation_code = b.inviter_code
|
||||||
|
WHERE
|
||||||
|
1 = 1
|
||||||
<if test="userName!=null and userName!=''">
|
<if test="userName!=null and userName!=''">
|
||||||
and user_name like concat('%',#{userName},'%')
|
and user_name like concat('%',#{userName},'%')
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue