刘嘉昕 | f28ea23 | 2025-04-15 16:55:43 +0800 | [diff] [blame] | 1 | package com.pt5.pthouduan.mapper; |
| 2 | |
| 3 | import com.pt5.pthouduan.entity.Invites; |
| 4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
Sure233 | 8188c5d | 2025-05-28 11:43:06 +0800 | [diff] [blame^] | 5 | import com.pt5.pthouduan.entity.User; |
刘嘉昕 | f28ea23 | 2025-04-15 16:55:43 +0800 | [diff] [blame] | 6 | import org.apache.ibatis.annotations.Mapper; |
Sure233 | 8188c5d | 2025-05-28 11:43:06 +0800 | [diff] [blame^] | 7 | import org.apache.ibatis.annotations.Param; |
| 8 | import org.apache.ibatis.annotations.Select; |
| 9 | import org.apache.ibatis.annotations.Update; |
| 10 | import org.springframework.stereotype.Repository; |
刘嘉昕 | f28ea23 | 2025-04-15 16:55:43 +0800 | [diff] [blame] | 11 | |
Sure233 | 8188c5d | 2025-05-28 11:43:06 +0800 | [diff] [blame^] | 12 | @Repository |
刘嘉昕 | f28ea23 | 2025-04-15 16:55:43 +0800 | [diff] [blame] | 13 | public interface InvitesMapper extends BaseMapper<Invites> { |
| 14 | |
Sure233 | 8188c5d | 2025-05-28 11:43:06 +0800 | [diff] [blame^] | 15 | @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); |
刘嘉昕 | f28ea23 | 2025-04-15 16:55:43 +0800 | [diff] [blame] | 26 | } |