Merge remote-tracking branch 'origin/test' into test

This commit is contained in:
GYJ 2024-12-28 18:55:58 +08:00
commit af8a0ece55
3 changed files with 34 additions and 15 deletions

View File

@ -28,7 +28,8 @@ public interface InviteDao extends BaseMapper<Invite> {
Double selectInviteSum(@Param("state") Integer state, @Param("userId") Long userId); Double selectInviteSum(@Param("state") Integer state, @Param("userId") Long userId);
IPage<Map<String,Object>> selectInviteUser(Page<Map<String,Object>> page, @Param("userId") Long userId,@Param("state") Integer state,@Param("userType") Integer userType); // IPage<Map<String,Object>> selectInviteUser(Page<Map<String,Object>> page, @Param("userId") Long userId,@Param("state") Integer state,@Param("userType") Integer userType);
IPage<Map<String,Object>> selectInviteUser(Page<Map<String,Object>> page,@Param("code") String code);
Invite selectInviteByUser(@Param("userId")Long userId,@Param("inviteeUserId") Long inviteeUserId,@Param("userType") Integer userType); Invite selectInviteByUser(@Param("userId")Long userId,@Param("inviteeUserId") Long inviteeUserId,@Param("userType") Integer userType);

View File

@ -72,7 +72,8 @@ public class InviteServiceImpl extends ServiceImpl<InviteDao, Invite> implements
@Override @Override
public PageUtils selectInviteUser(int page, int limit, Long userId, Integer state, Integer userType) { public PageUtils selectInviteUser(int page, int limit, Long userId, Integer state, Integer userType) {
Page<Map<String, Object>> pages = new Page<>(page, limit); Page<Map<String, Object>> pages = new Page<>(page, limit);
return new PageUtils(inviteDao.selectInviteUser(pages, userId, state, userType)); UserEntity userEntity = userService.queryByUserId(userId);
return new PageUtils(inviteDao.selectInviteUser(pages, userEntity.getInvitationCode()));
} }
@Override @Override

View File

@ -13,20 +13,37 @@
</select> </select>
<!-- <select id="selectInviteUser" resultType="Map">-->
<!-- select u.user_id as userId,u.user_name as userName,u.avatar as avatar,i.create_time as createTime,-->
<!-- ifnull(i.money,0.00) as money,ifnull(record.id,0) as recordNum,i.user_type as userType-->
<!-- from invite i-->
<!-- left join tb_user u on u.user_id=i.invitee_user_id-->
<!-- LEFT JOIN user_sign_record record ON i.invitee_user_id = record.user_id-->
<!-- where i.user_id=#{userId}-->
<!-- <if test="state!=null">-->
<!-- and i.state=#{state}-->
<!-- </if>-->
<!-- <if test="userType!=null">-->
<!-- and i.user_type=#{userType}-->
<!-- </if>-->
<!-- and u.user_id is not null-->
<!-- </select>-->
<select id="selectInviteUser" resultType="Map"> <select id="selectInviteUser" resultType="Map">
select u.user_id as userId,u.user_name as userName,u.avatar as avatar,i.create_time as createTime, SELECT "" as userId,
ifnull(i.money,0.00) as money,ifnull(record.id,0) as recordNum,i.user_type as userType user_name as userName,
from invite i avatar as avatar,
left join tb_user u on u.user_id=i.invitee_user_id u.create_time as createTime,
LEFT JOIN user_sign_record record ON i.invitee_user_id = record.user_id 0.00 as money,
where i.user_id=#{userId} ifnull(sub_orders.user_id, 0) as recordNum,
<if test="state!=null"> "" as userType
and i.state=#{state} FROM tb_user u
</if> LEFT JOIN (SELECT user_id
<if test="userType!=null"> FROM orders
and i.user_type=#{userType} WHERE pay_way = 9 AND `status` = 1
</if> GROUP BY user_id
and u.user_id is not null HAVING COUNT(*) >= 3) sub_orders ON u.user_id = sub_orders.user_id
WHERE u.inviter_code = #{code}
</select> </select>
<select id="sumInviteMoney" resultType="Double"> <select id="sumInviteMoney" resultType="Double">