package com.jt.test;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.jt.mapper.UserMapper;
import com.jt.pojo.User;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.net.PortUnreachableException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@SpringBootTest
public class BaseMapper {
@Autowired
private UserMapper userMapper;
//查询id查询数据库 id = 231
@Test
public void selectById(){
int id = 231;
userMapper.selectById(id);
}
}
@Test
public void selectById(){
int id = 231;
userMapper.selectById(id);
}
1.2.2 按照属性查询(使用构造器,创建对象封装数据)
@Test
public void select01(){
//1 通过创建对象封装数据
User user = new User();
user.setName("小乔").setSex("女");
//2 构建条件构造器 根据条件不为null的对象属性 构造Sql语句: sql:select * from demo_user where name = "小乔" and sex