用户类以及邀请码
Change-Id: I9a60a4e22146c46103099df91b5ecb138d1412b5
diff --git a/src/main/java/com/pt5/pthouduan/mapper/InvitesMapper.java b/src/main/java/com/pt5/pthouduan/mapper/InvitesMapper.java
index 6cc278b..fddf6df 100644
--- a/src/main/java/com/pt5/pthouduan/mapper/InvitesMapper.java
+++ b/src/main/java/com/pt5/pthouduan/mapper/InvitesMapper.java
@@ -2,17 +2,25 @@
import com.pt5.pthouduan.entity.Invites;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.pt5.pthouduan.entity.User;
import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
+import org.springframework.stereotype.Repository;
-/**
- * <p>
- * Mapper 接口
- * </p>
- *
- * @author ljx
- * @since 2025-04-14
- */
-@Mapper
+@Repository
public interface InvitesMapper extends BaseMapper<Invites> {
+ @Select("SELECT * FROM invite WHERE code = #{code}")
+ Invites selectByCode(String code);
+
+ @Update("UPDATE invite SET isUsed = 1, username = #{username} WHERE code = #{code}")
+ int updateInviteByCode(@Param("code") String code, @Param("username") String username);
+
+ @Select("SELECT * FROM invite WHERE buyername = '' LIMIT 1")
+ Invites selectFirstEmptyBuyername();
+
+ @Update("UPDATE invite SET buyername = #{buyername} WHERE code = #{code}")
+ int updatebuyer(@Param("code") String code, @Param("buyername") String buyername);
}