分销金额

This commit is contained in:
张松
2025-10-29 19:06:42 +08:00
parent c027336989
commit 3820d86c8a
10 changed files with 36 additions and 16 deletions

View File

@@ -71,4 +71,7 @@ public interface ShopUserMapper extends BaseMapper<ShopUser> {
* @return 分页结果
*/
List<InviteUserVO> getInviteUser(Long distributionUserId, Long shopUserId);
void updateOneOrTwoAmount(Long userId, Long mainShopId, BigDecimal bigDecimal, Integer isOne);
}

View File

@@ -14,5 +14,5 @@ import java.math.BigDecimal;
*/
public interface UserInfoMapper extends BaseMapper<UserInfo> {
int updateAmount(long userId, BigDecimal amount, Integer isOne);
int updateAmount(long userId, BigDecimal amount);
}

View File

@@ -169,4 +169,9 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
return list(queryWrapper);
}
@Override
public void updateOneOrTwoAmount(Long userId, Long mainShopId, BigDecimal bigDecimal, Integer isOne) {
mapper.updateOneOrTwoAmount(userId, mainShopId, bigDecimal, isOne);
}
}

View File

@@ -101,8 +101,8 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
}
@Override
public void updateDistributionAmount(long userId, BigDecimal amount, Integer isOne) {
int b = mapper.updateAmount(userId, amount, isOne);
public void updateDistributionAmount(long userId, BigDecimal amount) {
int b = mapper.updateAmount(userId, amount);
if (b <= 0) {
throw new CzgException("更新分销金额失败");
}

View File

@@ -17,6 +17,20 @@
where id = #{id}
and amount - #{money} >= 0
</update>
<update id="updateOneOrTwoAmount">
update tb_shop_user
<set>
<if test="isOne != null and isOne == 1">
one_income = one_income + #{amount}
</if>
<if test="isOne != null and isOne == 2">
two_income = two_income + #{amount}
</if>
</set>
where user_id = #{userId}
and shop_id = #{shopId}
</update>
<select id="selectUserSummary" resultType="com.czg.account.dto.shopuser.ShopUserSummaryDTO">

View File

@@ -8,12 +8,6 @@
update tb_user_info
<set>
distribution_amount = distribution_amount + #{amount}
<if test="isOne != null and isOne == 1">
, one_income = one_income + #{amount}
</if>
<if test="isOne != null and isOne == 2">
, two_income = two_income + #{amount}
</if>
</set>
where id = #{userId}
and distribution_amount + #{amount} >= 0