blob: 62eb9779f733250724010d3fa5ccfb2b040bfbcb [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
21301050e4db6a92025-06-08 23:42:43 +080012import java.util.List;
13import java.util.Map;
14
15/**
16 * <p>
17 * Mapper 接口
18 * </p>
19 *
20 * @author ljx
21 * @since 2025-04-14
22 */
Sure2338188c5d2025-05-28 11:43:06 +080023@Repository
刘嘉昕f28ea232025-04-15 16:55:43 +080024public interface InvitesMapper extends BaseMapper<Invites> {
25
Sure2338188c5d2025-05-28 11:43:06 +080026 @Select("SELECT * FROM invite WHERE code = #{code}")
21301050e4db6a92025-06-08 23:42:43 +080027 Map<String, Object> selectByCode(String code);
Sure2338188c5d2025-05-28 11:43:06 +080028
29 @Update("UPDATE invite SET isUsed = 1, username = #{username} WHERE code = #{code}")
30 int updateInviteByCode(@Param("code") String code, @Param("username") String username);
31
21301050e4db6a92025-06-08 23:42:43 +080032 @Select("SELECT * FROM invite WHERE (buyername = '' OR buyername IS NULL) LIMIT 1")
33 Map<String, Object> selectFirstEmptyBuyername();
Sure2338188c5d2025-05-28 11:43:06 +080034
35 @Update("UPDATE invite SET buyername = #{buyername} WHERE code = #{code}")
36 int updatebuyer(@Param("code") String code, @Param("buyername") String buyername);
21301050e4db6a92025-06-08 23:42:43 +080037
38 @Select("SELECT * FROM invite WHERE buyername = #{username}")
39 List<Map<String, Object>> selectInvitesByUsername(@Param("username") String username);
刘嘉昕f28ea232025-04-15 16:55:43 +080040}