You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
3.0 KiB

<?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.qniao.dam.infrastructure.persistent.dao.gmdp.GuildMemberDailyProfitDao">
<select id="statAll" resultType="com.qniao.dam.domain.aggregate.gmdp.entity.GuildMemberDailyProfit">
SELECT
guild_id,
user_id,
SUM(earnings) as earnings
from da_guild_member_profit_item
where is_delete=0
and create_time BETWEEN #{startTime} and #{endTime}
GROUP BY guild_id,user_id
</select>
<select id="stat" resultType="com.qniao.dam.domain.aggregate.gmdp.entity.GuildMemberDailyProfit">
SELECT guild_id,
user_id,
SUM(earnings) as earnings
from da_guild_member_profit_item
where is_delete = 0
and guild_id = #{guildId}
and user_id = #{userId}
and create_time BETWEEN #{startTime} and #{endTime}
GROUP BY guild_id, user_id
limit 1
</select>
<select id="pageDailyProfit"
resultType="com.qniao.dam.api.query.guild.user.response.PageGuildMemberDailyProfitVo">
SELECT
dagmdp.stat_date,
dagmdp.guild_id,
dag.`name` as guildName,
dagmdp.user_id,
dalm.id as liveMatchmakerId,
dalm.type as matchmakerType,
dami.nick_name,
dami.`name`,
daa.tid as phone,
dalm.create_time as registerTime,
dagm.create_time as joinTime,
dagmdp.earnings
from da_guild_member_daily_profit as dagmdp
LEFT JOIN da_guild as dag on dagmdp.guild_id=dag.id
LEFT JOIN da_live_matchmaker as dalm on dalm.is_delete=0 and dalm.user_id=dagmdp.user_id
LEFT JOIN da_user_marriage_information as daumi on daumi.is_delete=0 and daumi.user_id=dagmdp.user_id and
daumi.type=1
LEFT JOIN da_marriage_information as dami on dami.id=daumi.mi_id
LEFT JOIN da_account as daa on daa.is_delete=0 and daa.user_id=dagmdp.user_id and daa.type=2
LEFT JOIN da_guild_member as dagm on dagm.is_delete=0 and dagm.guild_id=dagmdp.guild_id and
dagmdp.user_id=dagm.user_id
where dagmdp.is_delete=0
<if test="queryParams.guildId != null">
and dagmdp.guild_id = #{queryParams.guildId}
</if>
<if test="queryParams.statDateFrom != null and queryParams.statDateTo != null">
and dagmdp.stat_date BETWEEN #{queryParams.statDateFrom} and #{queryParams.statDateTo}
</if>
<if test="queryParams.name != null and queryParams.name != '' ">
AND (dami.nick_name LIKE CONCAT('%', TRIM(#{queryParams.name}), '%') or
dami.`name` LIKE CONCAT('%', TRIM(#{queryParams.name}), '%'))
</if>
<if test="queryParams.phone != null and queryParams.phone != '' ">
AND daa.tid LIKE CONCAT('%', TRIM(#{queryParams.name}), '%')
</if>
ORDER BY dagmdp.stat_date desc
</select>
</mapper>