| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.tourguide.modules.user.entity.GuideUser; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Update; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | public interface GuideUserMapper extends BaseMapper<GuideUser> { |
| | | @Update("UPDATE guide_user SET accepted_order_count = accepted_order_count + 1, " + |
| | | "current_month_order_count = current_month_order_count + 1, updated_at = NOW() " + |
| | | "WHERE id = #{guideId} AND deleted = 0 AND status = 1") |
| | | int incrementAcceptedOrderCount(Long guideId); |
| | | |
| | | @Update("UPDATE guide_user SET status = 0, updated_at = NOW() " + |
| | | "WHERE id = #{guideId} AND deleted = 0 AND status = 1 " + |
| | | "AND auto_disable_whitelisted = 0 AND accepted_order_count >= #{orderThreshold} " + |
| | | "AND rating > 0 AND rating <= #{ratingThreshold}") |
| | | int autoDisableIfEligible(@Param("guideId") Long guideId, |
| | | @Param("orderThreshold") Integer orderThreshold, |
| | | @Param("ratingThreshold") BigDecimal ratingThreshold); |
| | | } |