liujie
2026-08-04 e9e42b621afdf6ac94f5327ee843b32b10a401b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package com.tourguide.modules.user.mapper;
 
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);
}