[CMLR-040] 迁移 User 域注解 SQL 到 Lambda

This commit is contained in:
2026-02-08 20:18:28 +08:00
parent 75badad2b2
commit 32a6d71748
3 changed files with 7 additions and 3 deletions

View File

@@ -1,6 +1,7 @@
package vvpkassistant.User.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -13,8 +14,10 @@ import java.util.List;
public interface UserDao extends BaseMapper<UserModel> {
// 根据用户的手机号查询用户
@Select("SELECT * FROM system_user WHERE mobile = #{phoneNumber}")
UserModel queryWithPhoneNumber(@Param("phoneNumber") String phoneNumber);
default UserModel queryWithPhoneNumber(String phoneNumber) {
return selectOne(Wrappers.<UserModel>lambdaQuery()
.eq(UserModel::getMobile, phoneNumber));
}
// 我邀请的pk数据
@Select("SELECT * FROM pk_record WHERE user_id_b = #{userId} ORDER BY id DESC LIMIT #{page}, #{size};")

View File

@@ -11,6 +11,7 @@ public class UserModel {
@TableId(type = IdType.AUTO)
private Integer id; // 主键
private String nickname; // 昵称
private String mobile; // 手机号
private Integer status; // 用户状态 0 正常 其他业务逻辑待定
private String userChatId; // 聊天使用的id使用微信的openid作为标识
private Integer points; // 用户积分