From 39f6fca28e3f78abe48f08e474ec011abb990b36 Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期三, 09 九月 2026 10:39:21 +0800
Subject: [PATCH] update
---
backend/src/main/java/com/tourguide/modules/user/mapper/GuideUserMapper.java | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/backend/src/main/java/com/tourguide/modules/user/mapper/GuideUserMapper.java b/backend/src/main/java/com/tourguide/modules/user/mapper/GuideUserMapper.java
index 3f18848..ef8bd96 100644
--- a/backend/src/main/java/com/tourguide/modules/user/mapper/GuideUserMapper.java
+++ b/backend/src/main/java/com/tourguide/modules/user/mapper/GuideUserMapper.java
@@ -9,6 +9,9 @@
import java.math.BigDecimal;
public interface GuideUserMapper extends BaseMapper<GuideUser> {
+ @Select("SELECT * FROM guide_user WHERE id = #{guideId} AND deleted = 0 FOR UPDATE")
+ GuideUser selectForUpdate(@Param("guideId") Long guideId);
+
@Select("SELECT COALESCE(balance, 0) FROM guide_user WHERE id = #{guideId} AND deleted = 0")
BigDecimal selectBalance(@Param("guideId") Long guideId);
@@ -25,7 +28,7 @@
"WHERE id = #{guideId} AND deleted = 0 AND status = 1")
int incrementAcceptedOrderCount(Long guideId);
- @Update("UPDATE guide_user SET status = 0, updated_at = NOW() " +
+ @Update("UPDATE guide_user SET status = 0, auto_disabled = 1, updated_at = NOW() " +
"WHERE id = #{guideId} AND deleted = 0 AND status = 1 " +
"AND COALESCE(auto_disable_whitelisted, 0) = 0 " +
"AND accepted_order_count >= #{orderThreshold} " +
@@ -33,4 +36,12 @@
int autoDisableIfEligible(@Param("guideId") Long guideId,
@Param("orderThreshold") Integer orderThreshold,
@Param("ratingThreshold") BigDecimal ratingThreshold);
+
+ @Update("UPDATE guide_user SET status = 1, auto_disabled = 0, updated_at = NOW() " +
+ "WHERE deleted = 0 AND status = 0 AND auto_disabled = 1 " +
+ "AND (COALESCE(auto_disable_whitelisted, 0) = 1 " +
+ "OR COALESCE(accepted_order_count, 0) < #{orderThreshold} " +
+ "OR COALESCE(rating, 0) <= 0 OR rating > #{ratingThreshold})")
+ int restoreAutoDisabledGuidesNoLongerEligible(@Param("orderThreshold") Integer orderThreshold,
+ @Param("ratingThreshold") BigDecimal ratingThreshold);
}
--
Gitblit v1.7.1