家族-收入-sql

This commit is contained in:
2025-09-22 11:47:33 +08:00
parent 8837bf906c
commit 3b23e19144
2 changed files with 6 additions and 9 deletions

View File

@@ -187,7 +187,7 @@ public class FamilyIncomeService {
itemVo.setMember(memberVo);
itemVo.setGoldIncome(goldIncomeMap.getOrDefault(item.getUid(), BigDecimal.ZERO));
itemVo.setGoldIncome(goldIncomeMap.getOrDefault(item.getId(), BigDecimal.ZERO));
itemVo.setMicRemainTime(DateTimeUtil.getTimeFormat(micRemainTimeMap.getOrDefault(item.getUid(), 0L).intValue()));
vo.setTotalGoldIncome(itemVo.getGoldIncome().add(vo.getTotalGoldIncome()));

View File

@@ -4,7 +4,7 @@
<select id="listTotalGoldGroupByFamilyMember"
resultType="com.accompany.business.model.family.FamilyMemberSerial">
select family_member_id, sum(total_gold_num) `serial_value`
select family_member_id, sum(fms.serial_value) `serial_value`
from family_member_serial fms
where 1=1
<if test="startDate != null and startDate != ''">
@@ -20,9 +20,6 @@
and fms.`date` &lt;= #{endDate}
</if>
and family_member_id in <foreach collection="familyMemberIdList" item="uid" separator="," open="(" close=")">#{uid}</foreach>
<if test="familyId != null">
and family_id = #{familyId}
</if>
group by family_member_id
</select>
@@ -45,7 +42,7 @@
<select id="listTotalGoldGroupByDate"
resultType="com.accompany.business.vo.family.FamilyUserIncomeItemVo">
select `date` `date`,
sum(fgr.total_gold_num) `gold_income`
sum(fms.serial_value) `gold_income`
from family_member_serial fms
where
fms.cycle_date between #{startDate} and #{endDate}
@@ -192,7 +189,7 @@
<select id="totalBdFamilyGoldNum" resultType="java.math.BigDecimal">
SELECT
ifnull(sum(fgr.total_gold_num),0)
ifnull(sum(fgr.serial_value),0)
FROM
bd_guild b
LEFT JOIN family f ON b.guild_id = f.id
@@ -211,7 +208,7 @@
left join family_member fm on f.id = fm.family_id and fm.`enable` = 1
left join family_gift_record fgr on fgr.family_id = fm.family_id and fm.uid = fgr.receiver_uid
and fgr.create_time &gt;=#{startDate} and fgr.create_time &lt;=#{endDate}
where f.`enable` = 1 and b.partition_id = 1 and b.bd_id = #{bdId} and b.`status` = 1 AND IFNULL(fgr.total_gold_num, 0) > 0
where f.`enable` = 1 and b.partition_id = 1 and b.bd_id = #{bdId} and b.`status` = 1 AND IFNULL(fgr.serial_value, 0) > 0
</select>
<select id="listBdFamilyGoldNum" resultType="com.accompany.business.vo.guild.GuildInfoVo">
@@ -221,7 +218,7 @@
f.avatar avatar,
f.`name` guildName,
f.owner_uid ownerUid,
ifnull(sum(fgr.total_gold_num), 0) diamondNum
ifnull(sum(fgr.serial_value), 0) diamondNum
FROM
bd_guild b
LEFT JOIN family f ON b.guild_id = f.id