blob: fddf6dfabefe87ef709fecf74df5aadd383a7ede [file] [log] [blame]
刘嘉昕f28ea232025-04-15 16:55:43 +08001package com.pt5.pthouduan.mapper;
2
3import com.pt5.pthouduan.entity.Invites;
4import com.baomidou.mybatisplus.core.mapper.BaseMapper;
Sure2338188c5d2025-05-28 11:43:06 +08005import com.pt5.pthouduan.entity.User;
刘嘉昕f28ea232025-04-15 16:55:43 +08006import org.apache.ibatis.annotations.Mapper;
Sure2338188c5d2025-05-28 11:43:06 +08007import org.apache.ibatis.annotations.Param;
8import org.apache.ibatis.annotations.Select;
9import org.apache.ibatis.annotations.Update;
10import org.springframework.stereotype.Repository;
刘嘉昕f28ea232025-04-15 16:55:43 +080011
Sure2338188c5d2025-05-28 11:43:06 +080012@Repository
刘嘉昕f28ea232025-04-15 16:55:43 +080013public interface InvitesMapper extends BaseMapper<Invites> {
14
Sure2338188c5d2025-05-28 11:43:06 +080015 @Select("SELECT * FROM invite WHERE code = #{code}")
16 Invites selectByCode(String code);
17
18 @Update("UPDATE invite SET isUsed = 1, username = #{username} WHERE code = #{code}")
19 int updateInviteByCode(@Param("code") String code, @Param("username") String username);
20
21 @Select("SELECT * FROM invite WHERE buyername = '' LIMIT 1")
22 Invites selectFirstEmptyBuyername();
23
24 @Update("UPDATE invite SET buyername = #{buyername} WHERE code = #{code}")
25 int updatebuyer(@Param("code") String code, @Param("buyername") String buyername);
刘嘉昕f28ea232025-04-15 16:55:43 +080026}