分销完善
This commit is contained in:
@@ -14,5 +14,5 @@ import java.math.BigDecimal;
|
||||
*/
|
||||
public interface UserInfoMapper extends BaseMapper<UserInfo> {
|
||||
|
||||
boolean updateAmount(long userId, BigDecimal amount);
|
||||
int updateAmount(long userId, BigDecimal amount);
|
||||
}
|
||||
|
||||
@@ -102,8 +102,8 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> i
|
||||
|
||||
@Override
|
||||
public void updateDistributionAmount(long userId, BigDecimal amount) {
|
||||
boolean b = mapper.updateAmount(userId, amount);
|
||||
if (!b) {
|
||||
int b = mapper.updateAmount(userId, amount);
|
||||
if (b <= 0) {
|
||||
throw new CzgException("更新分销金额失败");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<mapper namespace="com.czg.service.account.mapper.UserInfoMapper">
|
||||
|
||||
<update id="updateAmount">
|
||||
update tb_user_info set distribution_amount = distribution_amount + #{amount} where id = #{id}
|
||||
update tb_user_info set distribution_amount = distribution_amount + #{amount} where id = #{userId}
|
||||
and distribution_amount + #{amount} >= 0
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user