118 lines
4.2 KiB
Java
118 lines
4.2 KiB
Java
package com.ruoyi.promo.mapper;
|
|
|
|
import com.ruoyi.domain.entity.TtCommissionRecord;
|
|
import com.ruoyi.domain.entity.TtUserBlendErcash;
|
|
import com.ruoyi.domain.entity.sys.TtUser;
|
|
import com.ruoyi.promo.domain.dto.AnchorDayTurnoverDTO;
|
|
import com.ruoyi.promo.domain.dto.TotalUserExpenditureDTO;
|
|
import com.ruoyi.promo.domain.param.GetPlayersTurnoverParam;
|
|
import com.ruoyi.promo.domain.vo.AnchorDayTurnoverVO;
|
|
import com.ruoyi.promo.domain.vo.DayInviteVO;
|
|
import com.ruoyi.promo.domain.vo.DayTurnoverVO;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Select;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 推广流水Mapper
|
|
*/
|
|
@Mapper
|
|
public interface PromoTurnoverMapper {
|
|
|
|
@Select("select SUM(amount) from tt_user_blend_ercash where user_id = #{userId} and source = #{source}")
|
|
BigDecimal queryTotalRewardBySource(@Param("userId")Integer userId, @Param("source")Integer source);
|
|
|
|
@Select(
|
|
"<script>" +
|
|
"SELECT " +
|
|
" DATE(create_time) as dateStr " +
|
|
" FROM " +
|
|
" tt_user_blend_ercash " +
|
|
" WHERE " +
|
|
" user_id = #{userId}" +
|
|
" <if test=\"beginTime != null\">" +
|
|
" AND create_time >= #{beginTime}" +
|
|
" </if>\n" +
|
|
" <if test=\"endTime != null\">" +
|
|
" AND create_time <= #{endTime}" +
|
|
" </if>" +
|
|
" And (amount < 0 OR source = 1)" +
|
|
" GROUP BY " +
|
|
" DATE(create_time)" +
|
|
" ORDER BY " +
|
|
" DATE(create_time) DESC" +
|
|
"</script>")
|
|
List<String> queryPlayerErcash(@Param("userId") Integer userId,
|
|
@Param("beginTime") String beginTime, @Param("endTime") String endTime);
|
|
|
|
@Select("select SUM(amount) from tt_user_blend_ercash where user_id = #{userId} and DATE(create_time) = #{date} and amount < 0")
|
|
BigDecimal queryDailySum(@Param("userId")Integer userId, @Param("date")String date);
|
|
|
|
/**
|
|
* 获取直属主播数量
|
|
*/
|
|
int getAnchorCount(Integer userId);
|
|
|
|
/**
|
|
* 获取玩家流水
|
|
*/
|
|
BigDecimal getPlayersTurnover(GetPlayersTurnoverParam param);
|
|
|
|
/**
|
|
* 获取名下主播近10天日流水
|
|
*/
|
|
List<DayTurnoverVO> getLast10DaysTurnover(@Param("userIds") List<Integer> userIds,
|
|
@Param("sourceCodes") List<Integer> sourceCodes);
|
|
|
|
/**
|
|
* 获取名下主播近10天日邀请
|
|
*/
|
|
List<DayInviteVO> getLast10DaysInvite(Integer userId);
|
|
|
|
/**
|
|
* 查询名下主播每日流水
|
|
*/
|
|
List<AnchorDayTurnoverVO> getAnchorDayTurnover(AnchorDayTurnoverDTO anchorDayTurnoverDTO);
|
|
|
|
@Select("SELECT * FROM tt_user WHERE parent_id = #{parentId}")
|
|
List<TtUser> findByParentId(@Param("parentId") int parentId);
|
|
|
|
@Select("SELECT * FROM tt_user WHERE user_id = #{userId}")
|
|
TtUser findById(@Param("userId") int id);
|
|
|
|
/**
|
|
* 获取消费记录
|
|
*/
|
|
List<TtUserBlendErcash> getPurchaseByUserId(Integer userId);
|
|
|
|
|
|
@Select("select sum(total) from tt_user_blend_ercash where user_id = #{userId} and type=1 and source = 1 and create_time >= #{startDate} and create_time < #{endDate}")
|
|
BigDecimal getDailyTotalRecharge(@Param("userId") Integer userId,
|
|
@Param("startDate") Date startDate,
|
|
@Param("endDate") Date endDate);
|
|
|
|
/**
|
|
* 获取佣金比例
|
|
*/
|
|
BigDecimal getCommissionRateByUserId(Integer userId);
|
|
|
|
/**
|
|
* 修改佣金比例
|
|
*/
|
|
int updateCommissionRate(@Param("userId") Integer userId, @Param("commissionRate") BigDecimal commissionRate);
|
|
|
|
/**
|
|
* 获取佣金列表
|
|
*/
|
|
List<TtCommissionRecord> getCommissionList(Integer userId);
|
|
|
|
/**
|
|
* 获取上个月用户消费额
|
|
*/
|
|
List<TotalUserExpenditureDTO> getLastMonthTotalUserExpenditure();
|
|
}
|