分销关系

This commit is contained in:
2026-01-31 14:37:03 +08:00
parent 77334e3e73
commit 9c5b8ea53f
9 changed files with 203 additions and 79 deletions

View File

@@ -18,7 +18,7 @@
and amount - #{money} >= 0
</update>
<update id="updateOneOrTwoAmount">
update tb_shop_user
update mk_distribution_invite
<set>
<if test="isOne != null and isOne == 1">
one_income = one_income + #{amount}
@@ -27,7 +27,7 @@
two_income = two_income + #{amount}
</if>
</set>
where id = #{shopUserId}
where shop_user_id = #{shopUserId} and shop_id = #{shopId}
</update>
@@ -256,10 +256,10 @@
</select>
<select id="getInviteUser" resultType="com.czg.market.vo.InviteUserVO">
SELECT
invite.id AS shopUserId,
invite.head_img AS headImg,
invite.nick_name AS shopUserName,
invite.phone AS shopUserPhone,
u.id AS shopUserId,
u.head_img AS headImg,
u.nick_name AS shopUserName,
u.phone AS shopUserPhone,
invite.one_income AS oneIncome,
invite.invite_time AS inviteTime,
dist.total_income AS totalIncome,
@@ -269,12 +269,13 @@
dist.status AS status,
dist.distribution_level_id AS levelId,
dist.distribution_level_name AS levelName,
invite.distribution_shops AS distributionShops
FROM tb_shop_user invite
left join mk_distribution_user dist on invite.id = dist.id and dist.shop_id = #{shopId}
u.distribution_shops AS distributionShops
FROM mk_distribution_invite invite
left join tb_shop_user u on invite.shop_user_id = u.id
left join mk_distribution_user dist on invite.shop_user_id = dist.id
WHERE invite.`parent_user_id` = #{distributionUserId}
<if test="distributionLevelId != null">and dist.distribution_level_id = #{distributionLevelId}</if>
<if test="shopUserId != null">and invite.id = #{shopUserId}</if>
ORDER BY invite.`invite_time` DESC
ORDER BY u.`invite_time` DESC
</select>
</mapper>