liujie
2026-09-09 39f6fca28e3f78abe48f08e474ec011abb990b36
backend/src/main/java/com/tourguide/modules/user/mapper/GuideTeamMapper.java
@@ -2,6 +2,16 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tourguide.modules.user.entity.GuideTeam;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import java.math.BigDecimal;
public interface GuideTeamMapper extends BaseMapper<GuideTeam> {
    @Update("UPDATE guide_team SET balance = balance + #{amount}, updated_at = NOW() " +
            "WHERE id = #{teamId} AND deleted = 0")
    int increaseBalance(@Param("teamId") Long teamId, @Param("amount") BigDecimal amount);
    @Update("UPDATE guide_team SET balance = balance - #{amount}, updated_at = NOW() " +
            "WHERE id = #{teamId} AND deleted = 0 AND balance >= #{amount}")
    int decreaseBalance(@Param("teamId") Long teamId, @Param("amount") BigDecimal amount);
}