50 lines
2.1 KiB
XML
50 lines
2.1 KiB
XML
<?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.ruoyi.cai.mapper.UserInviteMapper">
|
|
|
|
<resultMap type="com.ruoyi.cai.domain.UserInvite" id="CaiUserInviteResult">
|
|
<result property="id" column="id"/>
|
|
<result property="userId" column="user_id"/>
|
|
<result property="inviteId" column="invite_id"/>
|
|
<result property="createTime" column="create_time"/>
|
|
</resultMap>
|
|
<select id="countInviteAndReward" resultType="com.ruoyi.cai.dto.app.dto.InviteCountDTO">
|
|
select ifnull(sum(reward_coin_total),0) as total_reward,
|
|
ifnull(count(1),0) as total_invite
|
|
from cai_user_invite
|
|
where invite_id = #{userId}
|
|
</select>
|
|
<select id="inviteUserPage" resultType="com.ruoyi.cai.dto.app.vo.user.UserListVo">
|
|
select t2.avatar,t2.gender,t2.city,t2.nickname,t2.usercode,t2.age, t1.create_time as bind_time
|
|
from cai_user_invite t1
|
|
join cai_user t2 on t1.user_id = t2.id
|
|
where t1.invite_id = #{inviteId}
|
|
</select>
|
|
<select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.UserInviteAdminVo">
|
|
select t1.*,
|
|
t2.usercode,t2.mobile,
|
|
t3.usercode as invite_usercode,t3.mobile as invite_mobile,t3.is_union as invite_is_union
|
|
from cai_user_invite t1
|
|
left join cai_user t2 on t1.user_id = t2.id
|
|
left join cai_user t3 on t1.invite_id = t3.id
|
|
<where>
|
|
<if test="bo.mobile != null and bo.mobile != ''">
|
|
and t2.mobile = #{bo.mobile}
|
|
</if>
|
|
<if test="bo.usercode != null and bo.usercode != ''">
|
|
and t2.usercode = #{bo.usercode}
|
|
</if>
|
|
<if test="bo.inviteMobile != null and bo.inviteMobile != ''">
|
|
and t3.mobile = #{bo.inviteMobile}
|
|
</if>
|
|
<if test="bo.inviteUsercode != null and bo.inviteUsercode != ''">
|
|
and t3.usercode = #{bo.inviteUsercode}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
</mapper>
|