mybatis-plus的坑
先看测试代码
User.java
@Data
public class User {
private String stu_num;
private String stu_name;
private String stu_gender;
private Integer stu_age;
private Integer cid;}
UserDao.java
@Mapper
public interface UserMapper {
@Select("select * from stu where stu_num=#{id}")
public User selectUserById(String id);
}
Junit测试
@Test
void selectById(){
User user= userMapper.selectUserById("20210103");
System.out.println(user);
}
使用Mybatis-Plus时使用@select注解写出查询语句返回对象User{stu_num='null', stu_name='null', stu_gender='null', stu_age=null, cid=1}只有cid正常显示,关掉mbp使用mybatis则正常,估计是mbp会对我的select语句重写,导致查询的数据不能正确查询数据,有没有大佬懂的,求解。